[求助]从终端读入个数,然后用英语逐位显示该数,比如:输入932 输出nine three two 怎
从终端读入个数,然后用英语逐位显示该数,比如:输入932 输出nine three two最好给完整的代码
大家帮我解下哈
在这先谢谢了呀
[此贴子已经被作者于2006-8-14 11:59:45编辑过]
简单问题要靠自己!
写了个:
#include "stdio.h"
#include "string.h"
main()
{
char array[100];
int i=0,len=0;
gets(array);
len=strlen(array);
for(i=0;i<len;i++)
switch(array[i])
{
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;
default:break;
}
printf("\n");
}