为什么这个程序在输入字符时就死循环?
#include<stdio.h> //输入字符时,程序死循环main()
{
int score,a,x,total=0,errtotal=0;
int acount=0,bcount=0,ccount=0,dcount=0,ecount=0;
printf("Please enter scores:\n");
while (scanf("%d",&score)!=EOF)
{
a=score/10;
if (score>=0&&score<=100)
{
switch(a)
{
case 10:
case 9:
{
++acount;
++total;
break;
}
case 8:
{
++bcount;
++total;
break;
}
case 7:
{
++ccount;
++total;
break;
}
case 6:
{
++dcount;
++total;
break;
}
default:
{
++ecount;
++total;
break;
}
}
}
else
{
printf("Sorry.You have input a wrong score.\n");
++errtotal;
}
}
printf("\n有效输入次数为:%d,无效输入次数为:%d\n",total,errtotal);
printf("总人数为:%d,成绩分布如下:\n",total);
printf("A级\tB级\tC级\tD级\tE级\n");
printf("%d人\t%d人\t%d人\t%d人\t%d人\n",acount,bcount,ccount,dcount,ecount);
}