还是不太理解
switch后面的表达式语句只能是整型变量或者字符型变量,sore/=10放外面试一下
#include <stdio.h>
int main()
{
int score = 87;
score/=10;
switch(score)
{
case 10:
case 9:
printf("等级A");
break;
case 8:
printf("等级B");
break;
case 7:
case 6:
printf("等级C");
break;
default:
printf("等级D");
break;
}
return 0;