用C语言编写一个程序,用户输入一个两位数,然后显示该数的英文单词
2个回答
展开全部
#include<stdio.h>
main()
{
char words[3][10][10]={{"","eleven","twelve","thirteen","亮困迟fourteen","fifteen","sixteen","seventeen","eighteen","nineteen"}
,{"","","twenty","thirty","forty","fifty","sixty","seventy","eighty","ninety"}
,{"","one","two","three","four","five"敬李,"six","seven","eight","nine"}};
int num;
start:
scanf("%d",&num);
if(num>尺纤99||num<10)printf("error\n");
else
{
if(num==10)printf("ten\n");
else if(num<20)printf("%s%\n",words[0][num-10]);
else{
printf("%s",words[1][num/10]);
if(num%10!=0)printf("-%s",words[2][num%10]);
printf("\n");
}
}
goto start;
}
main()
{
char words[3][10][10]={{"","eleven","twelve","thirteen","亮困迟fourteen","fifteen","sixteen","seventeen","eighteen","nineteen"}
,{"","","twenty","thirty","forty","fifty","sixty","seventy","eighty","ninety"}
,{"","one","two","three","four","five"敬李,"six","seven","eight","nine"}};
int num;
start:
scanf("%d",&num);
if(num>尺纤99||num<10)printf("error\n");
else
{
if(num==10)printf("ten\n");
else if(num<20)printf("%s%\n",words[0][num-10]);
else{
printf("%s",words[1][num/10]);
if(num%10!=0)printf("-%s",words[2][num%10]);
printf("\n");
}
}
goto start;
}
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询