开发平台(Platform): (Ex: Win10, Linux, ...)
win8
编译器(Ex: GCC, clang, VC++...)+目标环境(跟开发平台不同的话需列出)
GCC
额外使用到的函数库(Library Used): (Ex: OpenGL, ...)
stdio.h
问题(Question):
如何显示成 平常国字标准数字念法
末几位是0 不显示
从最左边起 遇到大于等于一个0
只显示一个零
喂入的资料(Input):
42002500
预期的正确结果(Expected Output):
肆仟贰百万贰仟五百元
错误结果(Wrong Output):
肆仟贰百零零贰百五十零元
程式码(Code):(请善用置底文网页, 记得排版,禁止使用图档)
https://ideone.com/XnET5L
#include <stdio.h>
void p1(int);
void p2(int);
char *dig[] = {"零","壹","贰","参","肆","伍","陆","柒","捌","玖"};
char *fer[] = {"\0","十","百","仟","万","十","百","仟","亿"};
int times=0;
int main()
{
int n;
printf("N = ");
scanf("%d",&n);
p1(n);
printf("元\n");
return 0;
}
void p1(int n)
{
int prefix,curryDig;
if( n < 10){
printf("%s",dig[n]);
p2(times);
}
else{
prefix = n / 10;
times++;
p1(prefix);
times