用C把浮点型的阿拉伯数字转译成中文大写如:123.12壹佰贰拾叁圆壹角贰分
来源:学生作业帮助网 编辑:六六作业网 时间:2025/01/11 23:31:16
用C把浮点型的阿拉伯数字转译成中文大写如:123.12壹佰贰拾叁圆壹角贰分
用C把浮点型的阿拉伯数字转译成中文大写
如:123.12
壹佰贰拾叁圆壹角贰分
用C把浮点型的阿拉伯数字转译成中文大写如:123.12壹佰贰拾叁圆壹角贰分
楼上的程序明显是简单的转换成数字啊
LZ要的是转换成货币.
你看看我的.
void main()
{
float x,y;
bool flag = true;
char *ch[]={"零","壹","贰","叁","肆","伍","陆","柒","捌","玖"};
char *ch1[]={"拾","佰","仟","万"};
char num[256];
int i,n,j,m;
printf("input:");
scanf("%f",&x);
n=(int)x;
for(i=0;i
朋友你的意思是要用C语言来转吧?
下次别放在英语里,记住了哦
以下程序做为参考,你试下
void main()
{
float x,y;
char *ch[]={"零","壹","贰","叁","肆","伍","陆","柒","捌","玖"};
char *ch1[]={"拾...
全部展开
朋友你的意思是要用C语言来转吧?
下次别放在英语里,记住了哦
以下程序做为参考,你试下
void main()
{
float x,y;
char *ch[]={"零","壹","贰","叁","肆","伍","陆","柒","捌","玖"};
char *ch1[]={"拾","佰","仟","万"};
char num[256];
int i,n,j,m;
printf("input:");
scanf("%f",&x);
n=(int)x;
for(i=0;i<=256&&n!=0;i++)
{
num[i]=(char)(n%10);
n/=10;
}
m=i;
num[i]='.';
y=x-n;
for(j=0;j<=256&&y<0;j++)
y=y*10;
for(i=m+1;i<=256&&y!=0;i++)
{num[i]=(char)(y%10);
y/=10;}
for(n=0;;n++)
{
if(num[n]=='.')
{
for(j=n-1;j>=0;j--)
{puts(ch[(int)num[j]])
if(m>=2)
{puts(ch1[m-2]);
m=m--;}
}
printf("点");
break;
}
}
for(i=i-1;num[i]!='.';i--;)
puts(ch[(int)num[i]]);
}
收起