代码已经AC,写的有点笨拙,大佬们多指点哈
#include<stdio.h>
int main()
{
int total=0;
char j=0;
while((j=getchar())!='\n')
total=total+j-48;
int a[4];
int i=0;
do
{
a[i]=total%10;
i++;
total=total/10;
}while(total);
char li[10][5] = {"ling","yi","er","san","si","wu","liu","qi","ba","jiu"};
if(i!=1)
{
for(int m=i;m>1;m--)
printf("%s ",li[a[m-1]]);
printf("%s",li[a[0]]);
}
else
printf("%s",li[a[0]]);
return 0;
}
网友评论