数字转换大写的中文
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 }
本文来自博客园,作者:Bytezero!,转载请注明原文链接:https://www.cnblogs.com/Bytezero/p/15072061.html