#include<stdio.h> #include<string.h> int main() { char a[10][10] = {"ling","yi","er","san","si","wu","liu","qi","ba","jiu"}; //用字符型数组和数字建立联系 char shuzi[1000]; gets(shuzi); int m = strlen(shuzi); for(int i=0;i<=m-1;i++) { if(shuzi[i]=='-') printf("fu"); else printf("%s",a[shuzi[i]-48]); // -48,0 在 ASCII 中 对应的是 48. if(i!= m-1) printf(" "); //控制空格,最后一个拼音后不需要输出空格 } return 0; }
标签:数字,int,char,shuzi,L1,007,include From: https://www.cnblogs.com/bzsc/p/17531861.html