c语言念数字
#include"stdio.h"#include"math.h"intmain(){inta,c,b=0,temp,r;inti,j,k;scanf("%d",&a);...
#include"stdio.h"
#include"math.h"
int main()
{
int a,c,b=0,temp,r;
int i,j,k;
scanf("%d",&a);
if(a<0)
{
printf("fu ");
a=-a;
}
c=a;
while(temp!=0)
{
b++;
c=c/10;
temp=c;
}
for(i=1;i<=b;i++)
{
r++;
j=pow(10,b-i);
k=a/j;
a=a%j;
switch(k)
{
case 0:
printf("ling");break;
case 1:
printf("yi");break;
case 2:
printf("er");break;
case 3:
printf("san");break;
case 4:
printf("si");break;
case 5:
printf("wu");break;
case 6:
printf("liu");break;
case 7:
printf("qi");break;
case 8:
printf("ba");break;
case 9:
printf("jiu");break;
}
if(r!=b)
printf(" ");
}
}
帮忙看看哪里错了。 展开
#include"math.h"
int main()
{
int a,c,b=0,temp,r;
int i,j,k;
scanf("%d",&a);
if(a<0)
{
printf("fu ");
a=-a;
}
c=a;
while(temp!=0)
{
b++;
c=c/10;
temp=c;
}
for(i=1;i<=b;i++)
{
r++;
j=pow(10,b-i);
k=a/j;
a=a%j;
switch(k)
{
case 0:
printf("ling");break;
case 1:
printf("yi");break;
case 2:
printf("er");break;
case 3:
printf("san");break;
case 4:
printf("si");break;
case 5:
printf("wu");break;
case 6:
printf("liu");break;
case 7:
printf("qi");break;
case 8:
printf("ba");break;
case 9:
printf("jiu");break;
}
if(r!=b)
printf(" ");
}
}
帮忙看看哪里错了。 展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询