学习了。
回复 10楼 m21wo
然后我这样编了下面:# include <stdio.h>
# include <stdlib.h>
int main (void)
{
int x,y,n;
n=10*x+y;
printf ("Enter a two-digit number:");
scanf ("%1d%1d",&x,&y);
printf("You entered the nember ");
if (n>=20)
{
switch (x) {
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 (y) {
case 0: printf(""); 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
{
switch (n) {
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("sixteen"); break;
case 17: printf("seventeen"); break;
case 18: printf("eighteen"); break;
case 19: printf("nineteen"); break;
}
}
system ("pause");
return 0;
}
可是红色部分好像没有作用,我输入 10 的时候,显示的是“”(也就是空格)
又是哪里错了呢?