#include
int main()
{
int grade,score;
while(scanf("%d",&score)!=EOF)
{
grade=score/10;
if(score>100||score<0) // 添加判定
printf("Score is error!\n");
else
switch(grade)
{
case 10:
case 9:printf("A\n");break;
case 8:printf("B\n");break;
case 7:printf("C\n");break;
case 6:printf("D\n");break;
case 5:
case 4:
case 3:
case 2:
case 1:
case 0:printf("E\n");break;
default:printf("Score is error!\n");
}
}
return 0;
}
代码的目的是90:A
80:B
70:C
60:D
60以下输出Score is error!