| 网站首页 | 业界新闻 | 小组 | 交易 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛

#include<stdio.h>
main(void)
{
int i,j=0,k,s;
int w[9];
double a,b,c;
scanf("%lf",&a);
a=a+0.001;
s=a;
k=(a-s)*100;
if((a-s)>0)
{
w[1]=k/10;
w[0]=k%10;
}
else
{
w[1]=0;
w[0]=0;
}
while(s!=0)
{
w[2+j]=s%10;
s=s/10;
j++;
}
for(i=9;i>=j+2;i–)
w[i]=0;
for(i=j+1;i>=0;i–)
{
switch(w[i])
{
case 1:printf(“壹”);break;
case 2:printf(“贰”);break;
case 3:printf(“叁”);break;
case 4:printf(“肆”);break;
case 5:printf(“伍”);break;
case 6:printf(“陆”);break;
case 7:printf(“柒”);break;
case 8:printf(“捌”);break;
case 9:printf(“玖”);break;
case 0:printf(“零”);break;
}
switch(i+1)
{
case 1:printf(“分”);break;
case 2:printf(“角”);break;
case 3:printf(“元”);break;
case 4:printf(“拾”);break;
case 5:printf(“佰”);break;
case 6:printf(“仟”);break;
case 7:printf(“万”);break;
case 8:printf(“拾”);break;
case 9:printf(“佰”);break;
}

}
printf("\n");
return 0;
}

-- 不是–

```#define _CRT_SECURE_NO_WARNINGS
#include<stdio.h>
int main(void)
{
int i, j = 0, k, s;
int w[9] = {0};
double a;
scanf("%lf", &a);
a += 0.001;
s = (int)a;
k = (a - s) * 100;
if ((a - s) > 0)
{
w[1] = k / 10;
w[0] = k % 10;
}
else
{
w[1] = 0;
w[0] = 0;
}
while (s != 0)
{
w[2 + j] = s % 10;
s = s / 10;
j++;
}

for (i = j + 1; i >= 0; i--)
{
switch (w[i])
{
case 1:printf("壹"); break;
case 2:printf("贰"); break;
case 3:printf("叁"); break;
case 4:printf("肆"); break;
case 5:printf("伍"); break;
case 6:printf("陆"); break;
case 7:printf("柒"); break;
case 8:printf("捌"); break;
case 9:printf("玖"); break;
case 0:printf("零"); break;
}
switch (i + 1)
{
case 1:printf("分"); break;
case 2:printf("角"); break;
case 3:printf("元"); break;
case 4:printf("拾"); break;
case 5:printf("佰"); break;
case 6:printf("仟"); break;
case 7:printf("万"); break;
case 8:printf("拾"); break;
case 9:printf("佰"); break;
}

}
printf("\n");
return 0;
}
```

```#include<stdio.h>
int main(void)
{
int i, n;
int w[9] = { 0 };
double a;
char d1[] = "零壹贰叁肆伍陆柒捌玖", d2[] = "分角元拾佰仟万拾佰";
scanf("%lf", &a);
n = a * 100;
for (i = 0; n; n /= 10)w[i++] = n % 10;
for (i --; i >= 0; i--)
{
printf("%c%c%c%c", d1[w[i] * 2], d1[w[i] * 2 + 1],d2[i*2],d2[i*2+1]);
}
printf("\n");
return 0;
}```

• forever742020-06-06 11:17 送鲜花  1朵   附言：赞

• 3
• 1/1页
• 1