输入两位数,显示该数的英文~ 如何编写(哪里错了)~~
编写一个程序,要求用户输入一个两位数,然后显示该数的英文单词:Enter a two-digit number: 45
You entered the number forty-five.
提示:把数分解为两个数字。用一个switch语句显示第一位数字对应的单词(“twenty”、“thirty”等),
用第二个switch语句显示第二位数字对应的单词。不要忘记11-19需要特殊处理。
# include <stdio.h>
# include <stdlib.h>
int main (void)
{
int x,y,n;
printf ("Enter a two-digit number:");
scanf ("%d%d\n",&x,&y);
printf("You entered the nember ");
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("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;
}
system ("pause");
return 0;
}
请问我编写的哪里错了,还有11到19应该怎么写呢?