#include<cstdio>
#include<cstring>
char strnumber[16][5] = {
"ling", "yi", "er", "san", "si", "wu", "liu", "qi",
"ba", "jiu", "Ge", "Shi", "Bai", "Qian", "Wan", "Yi"
};
int main(){
char str[16];
scanf("%s", str);
int len = strlen(str);
int flag = 0;
if(str[0] == '-') {
printf("Fu");
flag = 1;
}
//8132345680080898
int Data[100], top = 0, start1, start2, start3, start4;
start1 = start2 = start3 = start4 = 10;
int iswan, isqian, isyi, iswanyi;
iswan = isqian = isyi = iswanyi = 0;
for(int i = len-1; flag ? i > 0 : i >= 0; i--){
if(len == 1){
Data[top++] = str[i]- '0';
}else if(i >= len - 4 && i <= len - 1){
Data[top++] = start1++;
Data[top++] = str[i] - '0';
}else if(i >= len - 8 && i <= len - 5){
if(iswan == 0){
Data[top++] = 14;
iswan = 1;
}
Data[top++] = start2++;
Data[top++] = str[i] - '0';
}else if(i >= len - 12 && i <= len - 9){
if(isyi == 0){
Data[top++] = 15;
isyi = 1;
}
Data[top++] = start3++;
Data[top++] = str[i] - '0';
}else if(i >= len - 16 && i <= len - 13){
if(iswanyi == 0){
Data[top++] = 14;
iswanyi = 1;
}
Data[top++] = start4++;
Data[top++] = str[i] - '0';
}
}
int sign = 0;
for(int i = top-1; i > 0; i = i - 1){
if(Data[i] != 10){
if(Data[i] == 0){
i = i - 1;
continue;
}
if(i != top - 1 || str[0] == '-'){
printf(" %s", strnumber[Data[i]]);
}else{
printf("%s", strnumber[Data[i]]);
}
}
}
return 0;
}
千万亿 百万亿 十万亿 万亿 千亿 百亿 十亿 亿 千万 百万 十万 万 千 百 十 个
234 134 034 34 24 14 04 4 23 13 03 3 2 1 0
8132 3456 8008 0898
ba Qian yi Bai san Shi er Wan
san Qian si Bai wu Shi liu Yi
ba Qian ling ba Wan
ling ba Bai jiu Shi ba
8132345680080898
原文地址:https://www.cnblogs.com/zjsaipplp/p/10425258.html
时间: 2024-09-27 11:53:23