回复 7楼 九转星河
我改成了这样,没问题了,但我觉得程序有点冗杂,用了两个输入语句
#include<stdio.h>
int main()
{
int score;
char grade;
printf("Please input score:");
scanf("%d", &score);
while(score < 0 || score > 100)
{
printf("Input error!\n");
printf("Please input score:");
scanf("%d", &score);
}
if (score >= 90)
grade = 'A';
else if (score >= 80)
grade = 'B';
else if (score >= 70)
grade = 'C';
else if (score >= 60)
grade = 'D';
else
grade = 'E';
printf("grade:%c\n", grade);
return 0;
}