数字翻译器程序

整理文档很辛苦,赏杯茶钱您下走!

免费阅读已结束,点击下载阅读编辑剩下 ...

阅读已结束,您可以下载文档离线阅读编辑

资源描述

#includestdio.hchardata_1[19][10]={one,two,three,four,five,six,seven,eight,nine,ten,eleven,twelve,thirteen,forteen,fifteen,sixteen,seventeen,eighteen,ninteen};chardata_2[8][8]={twenty,thirty,forty,fifty,sixty,seventy,eighty,ninty};translation_A(longN){/*翻译千位数*/longa;if(N==0){printf(Zero\n);return;}a=N/1000;if(a!=0){translation_B(a);printf(thousand);}a=N%1000;if(a!=0)translation_B(a);}translation_B(longa){/*翻译百位数*/longb;b=a/100;if(b!=0){translation_C(b);printf(hundred);}b=a%100;if(b!=0)translation_C(b);}translation_C(longb){/*翻译十位数和个位数*/longc;if(b=19)printf(%s,data_1[b-1]);else{c=b/10;printf(%s,data_2[c-2]);c=b%10;if(c!=0)printf(%s,data_1[c-1]);}}main(){longN;printf(Pleaseinputalongegerfrom0~999999\n);scanf(%ld,&N);while(N=0&&N=999999){translation_A(N);printf(\nPleaseinputalongegerfrom0~999999\n);scanf(%ld,&N);}getche();}

1 / 2
下载文档,编辑使用

©2015-2020 m.777doc.com 三七文档.

备案号:鲁ICP备2024069028号-1 客服联系 QQ:2149211541

×
保存成功