error C2046: illegal case 哪里错了

2024-12-25 20:25:18
推荐回答(2个)
回答1:

switch (grade);
改为:
switch (grade)

回答2:

#include
void main()
{
char grade;
scanf("%c",&grade);
switch (grade)
{ case 'A':printf("85~100\n");break;
case 'B':printf("70~84\n"); break;
case 'C':printf("60~69\n"); break;
case 'D':printf("<60\n"); break;
default:printf("error\n"); break;
}
}