数字转换大写的中文

 1 #include <stdio.h>
 2 int main()
 3 {
 4 
 5      int moneys[6];
 6      char  unit[10][4] ={"","","","","","","","","",""};
 7      int i =0;
 8      int money,count = 0;  //count是位数
 9 
10 
11      printf("请输入金额:");
12      scanf("%d",&money);
13 
14      while(money != 0)
15      {
16         moneys[i] = money % 10;
17         money /=10;            //去掉最后一位
18         i++;
19         count ++;
20      }
21 
22      printf("用户输入的数字一共有%d位!",count);
23      printf("数组中的内容:\n");
24 
25      for(i = 0; i < count; i++)
26      {
27         printf("%d - %s\n",moneys[i],unit[moneys[i]]);
28      }
29 
30 }

 

posted on 2021-07-28 11:00  Bytezero!  阅读(53)  评论(0编辑  收藏  举报