发布网友 发布时间:2024-10-24 03:24
共1个回答
热心网友 时间:2024-11-08 18:38
编译问题是改好了,但是你的程序逻辑有问题,自己找一找吧,
#include <stdio.h>
#include <string.h>
void changeinto(char b[]);
char money[][4]={"零","壹","贰","叁","肆","伍","陆","柒","捌","玖"};
char a[][3]={"元","拾","佰","仟","万","拾","佰","仟","亿"};
void main()
{
char b[10];
printf("please input money\n");
gets(b);
changeinto(b);
}
void changeinto(char b[])
{
int i,j=0,n=strlen(b);
for(i=0;i<n;i++)
j=a[i][0]-'0';
printf("%s",a[j]);
}
提示一下:
钱数依次取最高位,将最高位值和money匹配,将最高位的位数和a匹配