- 题目:数字怎么念 编程,输入一个整数,输出每个数字对应的拼音。当整数为负数时,先输出fu。十个数字对应的拼音如下: 0: ling 1: yi 2: er 3: san 4: si 5: wu 6: liu 7: qi 8: ba 9: jiu
-
#include <stdio.h>
#include <string.h>
#define MAXSIZE 100int main()
{
char str[MAXSIZE];
int length,i;
scanf("%s",str);
length = strlen(str);
for(i = 0;i < length;i++){
switch(str[i]){
case '-':
printf("fu");
break;
case '0':
printf("ling");
break;
case '1':
printf("yi");
break;
case '2':
printf("er");
break;
case '3':
printf("san");
break;
case '4':
printf("si");
break;
case '5':
printf("wu");
break;
case '6':
printf("liu");
break;
case '7':
printf("qi");
break;
case '8':
printf("ba");
break;
case '9':
printf("jiu");
break;
}
if(i != length - 1)
printf(" ");
}
return 0;
}
C语言 (4)数据结构 数字怎么念
最新推荐文章于 2022-11-06 01:28:38 发布