#include <stdio.h>
#include <math.h>
void main()
{
char *a[7]={"0","0","十","百","千","万","亿"};
char *b[10]={"0","一","二","三","四","五","六","七","八","九"};
int i,n,num=0,temp;
scanf("%d",&n);
temp = n;
while(temp!=0)
{
temp=temp/10;
num++;
}
temp = n;
while(temp!=0)
{
i=temp/(pow(10,(num-1)));
printf("%s",b[i]);
if(num>1)
{
printf("%s",a[num]);
}
temp=temp-i*(pow(10,(num-1)));
num--;
}
printf("\n");
}
输入int123,输出string一百二十三,假设最大是亿。
最新推荐文章于 2024-05-16 16:38:00 发布