标签:
#include <stdio.h>
int main()
{
int i;
char tens,sin;
printf("enter a two-digit number:\n");
scanf("%d",&i);
if(20<=i&&i<100)
{
tens=i/10;
sin =i%10;
switch(tens)
{
case 2:printf("twenty");break;
case 3:printf("thirty");break;
case 4:printf("fourty");break;
case 5:printf("fifty");break;
case 6:printf("twenty");break;
case 7:printf("seventy");break;
case 8:printf("eighty");break;
case 9:printf("ninety");break;
}
switch(sin)
{
case 0:printf("-zero");break;
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;
}
}
else if(9<i&&i<20)
{
switch(i)
{
case 10:printf("ten");break;
case 11:printf("eleven");break;
case 12:printf("twelve");break;
case 13:printf("thirteen");break;
case 14:printf("fourteen");break;
case 15:printf("fifteen");break;
case 16:printf("sixeen");break;
case 17:printf("seventeen");break;
case 18:printf("eighteen");break;
case 19:printf("nineteen");break;
}
}
else
printf("erro\n");
return 0;
}
//个别英文有错误,改一下就可以了。但,程序整体思路还是可以的,就是太复杂。
标签:
原文地址:http://www.cnblogs.com/boyiliushui/p/4387713.html