帮我看看这个代码有没有出错,谢谢
/* Note:Your choice is C IDE */#include "stdio.h"
void main()
{
float x;
int y;
printf("请输入分数:");
scanf("%f",&x);
if(x<60)y=5;
else if(60<=x<69)y=4;
else if(70<=x<79)y=3;
else if(80<=x<89) y=2;
else if(90<=x<=100) y=1;
switch(y)
{
case 1:printf("%c",'A');break;
case 2:printf("%c",'B');break;
case 3:printf("%c",'C');break;
case 4:printf("%c",'D');break;
case 5:printf("%c",'E');break;
default:printf("输入有误,请重新输入");
}
} #include "stdio.h"
void main()
{
float x;
int y;
printf("请输入分数:");
scanf("%f",&x);
if(x<=60) y=5;
else if(x<=70) y=4;
else if(x<=80)y=3;
else if(x<=90) y=2;
else if(x<=100) y=1;
switch(y)
{
case 1:printf("%c\n",'A');break;
case 2:printf("%c\n",'B');break;
case 3:printf("%c\n",'C');break;
case 4:printf("%c\n",'D');break;
case 5:printf("%c\n",'E');break;
default:y = 8;
break;
}
把变量放在等号的左边,这样看看
页:
[1]