运用switch case的成绩统计
#include<stdio.h>
#include<stdlib.h>
int main()
{
int i,j,a;
while(scanf("%d",&a)!=EOF)
{
switch(a/10)
{
case 10:
case 9:
{
printf("Excellent\n");
break;
}
case 8:
{
printf("Good\n");
break;
}
case 7:
{
printf("Average\n");
break;
}
case 6:
{
printf("Pass\n");
break;
}
case 5:
case 4:
case 3:
case 2:
case 1:
{
printf("Failing\n");
break;
}
case 0:
{
if(a>=0)
printf("Failing\n");
else printf("Error\n");
break;
}
default:
printf("Error\n");
}
}
return 0;
}