题目:http://acm.hdu.edu.cn/showproblem.php?pid=2004
参考:
#include<stdio.h>
int main()
{
int score;
while (scanf("%d", &score) != EOF)
{
if (score<0 || score>100)
printf("Score is error!\n");
else
switch (score / 10)
{
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;
default:
printf("E\n");
break;
}//或者将不在0~100范围的数写在default中,而将E的所有情况列出
}
return 0;
}