C语言的问题 ,大神来帮帮我吧~~~~~~~~~~~~题目如图!
2个回答
展开全部
//刚写的code,测试通过,如果有疑问,欢迎交流
#include<stdio.h>
char digit_lib[10][5] = {"ling","yi","er","san","si","wu","liu","qi","ba","jiu"};
void print_pos_digit(int tar, int *is_first){
if(tar==0){
*is_first = 1;
return;
}
print_pos_digit(tar/10, is_first);
if(*is_first == 1){
printf("%s", digit_lib[tar%10]);
*is_first = 0;
}
else
printf(" %s", digit_lib[tar%10]);
}
int main(){
int tar;
scanf("%d", &tar);
int flag = 0;
if(tar<0){
printf("fu ");
print_pos_digit(-tar, &flag );
}else
print_pos_digit(tar, &flag);
printf("\n");
}
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
#include <stdio.h>
#include <string.h>
int main()
{
char str[20];
char py[][6]={"ling","yi","er","san","si","wu","liu","qi","ba","jiu"};
scanf("%s",&str);
if(str[0]=='-') printf("fu");
else printf("%s",py[str[0]-'0']);
for(int i=1;str[i]!=0;i++)
printf(" %s",py[str[i]-'0']);
}
本回答被提问者采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询