C Number to Text问题有一个和十个

    #include<stdio.h>
#include<conio.h>

main()
{

int ones,tens,ventoteen,teens, myloop = 0;
long num2,cents2,centeens,cents1,thousands,hundreds;
double num;

do{

printf("Enter a number: ");
scanf("%lf",&num);

if (num>10000 || num <0)
printf("Wrong Choice of Numbern");
if (num==0)
printf("ttZero");
else{

num=(num*100);
num2= (long)num;


thousands=num2/100000;
num2=num2%100000;
hundreds=num2/10000;
num2=num2%10000;

if ((num2>=1100) && (num2<=1900)){
ones = 0;
tens = 0;
ventoteen = num2%1000;
teens = ventoteen/1;

}
else
{

tens=num2/1000;
num2=num2%1000;
ones=num2/100;
num2=num2%100;
}


if((num2>=11) && (num2<=19))
{
cents1=0;
cents2=0;
centeens=num2%10;
}
else
{
cents1=num2/10;
num2=num2%10;
cents2=num2/1;
}


if (thousands == 1)
printf("One thousand ");
else if (thousands == 2)
printf("Two thousand ");
else if (thousands == 3)
printf("Three Thousand ");
else if (thousands == 4)
printf("Four thousand ");
else if (thousands == 5)
printf("Five Thousand ");
else if (thousands == 6)
printf("Six thousand ");
else if (thousands == 7)
printf("Seven Thousand ");
else if (thousands == 8)
printf("Eight thousand ");
else if (thousands == 9)
printf("Nine Thousand ");


if (hundreds == 1)
printf("one hundred ");
else if (hundreds == 2)
printf("two hundred ");
else if (hundreds == 3)
printf("three hundred ");
else if (hundreds == 4)
printf("four hundred ");
else if (hundreds == 5)
printf("five hundred ");
else if (hundreds == 6)
printf("six hundred ");
else if (hundreds == 7)
printf("seven hundred ");
else if (hundreds == 8)
printf("eight hundred ");
else if (hundreds == 9)
printf("nine hundred ");




switch(teens)
{
case 1: printf("eleven ");break;
case 2: printf("twelve ");break;
case 3: printf("thirteen ");break;
case 4: printf("fourteen ");break;
case 5: printf("fifteen ");break;
case 6: printf("sixteen ");break;
case 7: printf("seventeen ");break;
case 8: printf("eighteen ");break;
case 9: printf("nineteen ");break;
}


switch(tens)
{
case 1: printf("ten ");break;
case 2: printf("twenty ");break;
case 3: printf("thirty ");break;
case 4: printf("forty ");break;
case 5: printf("fifty ");break;
case 6: printf("sixty ");break;
case 7: printf("seventy ");break;
case 8: printf("eighty ");break;
case 9: printf("ninety ");break;
}
switch(ones)
{
case 1: printf("one ");break;
case 2: printf("two ");break;
case 3: printf("three ");break;
case 4: printf("four ");break;
case 5: printf("five ");break;
case 6: printf("six ");break;
case 7: printf("seven ");break;
case 8: printf("eight ");break;
case 9: printf("nine ");break;
}

switch(cents1)
{
case 1: printf("and ten centavos ");break;
case 2: printf("and twenty centavos ");break;
case 3: printf("and thirty centavos ");break;
case 4: printf("and fourty centavos ");break;
case 5: printf("and fifty centavos ");break;
case 6: printf("and sixty centavos ");break;
case 7: printf("and seventy centavos ");break;
case 8: printf("and eighty centavos ");break;
case 9: printf("and ninety centavos ");break;
}

switch(centeens)
{
case 1: printf("and eleven centavos ");break;
case 2: printf("and twelve centavos ");break;
case 3: printf("and thirteen centavos ");break;
case 4: printf("and fourteen centavos ");break;
case 5: printf("and fifteen centavos ");break;
case 6: printf("and sixteen centavos ");break;
case 7: printf("and seventeen centavos ");break;
case 8: printf("and eighteen centavos ");break;
case 9: printf("and nineteen centavos ");break;

}

switch(cents2)
{
case 1: printf("and one centavos ");break;
case 2: printf("and two centavos ");break;
case 3: printf("and three centavos ");break;
case 4: printf("and four centavos ");break;
case 5: printf("and five centavos ");break;
case 6: printf("and six centavos ");break;
case 7: printf("and seven centavos ");break;
case 8: printf("and eight centavos ");break;
case 9: printf("and nine centavos ");break;
}
}



getch();
}while(myloop == 0);
return 0;
}
我的代码工作正常,但问题是当我输入1 - 90什么都没有出现,但当我输入100输出将是好的,这是“一百”,所以1000输出将是“一千”。谢谢您的帮助..     
已邀请:
那个条件: if((num2> = 1100)||(num2&lt; = 1900)) 永远满足。意思是: if((num2> = 1100)&amp;&amp;(num2&lt; = 1900))     

要回复问题请先登录注册