解题思路:
注意事项:
参考代码:#include <cstdio>int main(){
char* num[] = {"ling","yi","er","san","si","wu","liu","qi","ba","jiu"};
char* wei[] = {"shi","bai","qian","wan","yi"};
char* str[20];
int n,l[2] = {0};
scanf("%d",&n);
int i=0,j=0;
int k;
while(n>0)
{
k=n%10;
n/=10;
if(k>0)
{
if(i>0)
{
if(i>=4&&!l[i/4-1])
{
l[i/4-1]=1;
str[j++]=wei[i/4+2];
}
if(i%4!=0)str[j++]=wei[i%4-1];
}
str[j++]=num[k];
}
else if(j>0&&str[j-1]!=num[0])
str[j++]=num[0];
i++;
}
if(!(str[j-1]==num[1]&&j>1&&str[j-2]==wei[0]))
printf("%s ",str[j-1]);
for(int a = j-2; a >= 0; a --)
printf("%s ",str[a]);
return 0;}
0.0分
1 人评分
C语言训练-求1+2!+3!+...+N!的和 (C语言代码)浏览:575 |
简单的a+b (C语言代码)浏览:564 |
C语言程序设计教程(第三版)课后习题5.7 (C语言代码)浏览:591 |
WU-链表数据求和操作 (C++代码)浏览:1382 |
1024题解浏览:879 |
矩阵乘方 (C语言代码)浏览:1079 |
小九九 (C语言描述,不看要求真坑爹)浏览:1006 |
C二级辅导-同因查找 (C语言代码)浏览:618 |
【出圈】 (C++代码)简单循环浏览:699 |
非常简单的算法,题解1049:C语言程序设计教程(第三版)课后习题11.1 (C语言代码)浏览:639 |