c语言一直提醒浮点错误
#include<stdio.h>intmain(){intr;inta;scanf("%d",&r);intx=r;inti=0;intmask=1;if(r<0){p...
#include <stdio.h>
int main()
{
int r;
int a;
scanf("%d",&r);
int x=r;
int i=0;
int mask=1;
if(r<0){
printf("fu ");
x=-r;
r=-r;
}
for(i=0;x>=10;i++){
x=x/10;
mask*=10;
}
while(mask>=0){
a=r/mask;
a=a%10;
if(a==0){
printf("ling");
}
switch(a){
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;
}
mask /=10;
if(mask>=0){
printf(" ");
}
}
} 展开
int main()
{
int r;
int a;
scanf("%d",&r);
int x=r;
int i=0;
int mask=1;
if(r<0){
printf("fu ");
x=-r;
r=-r;
}
for(i=0;x>=10;i++){
x=x/10;
mask*=10;
}
while(mask>=0){
a=r/mask;
a=a%10;
if(a==0){
printf("ling");
}
switch(a){
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;
}
mask /=10;
if(mask>=0){
printf(" ");
}
}
} 展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询