错误的地方不是那里
#include
void main ( )
{
float score;
char grade;
printf("请输入成绩%%f\n");
scanf("%f",&score);
switch(int(score/10))
{
case 10:
case 9: grade='A';break;//是'A'有单引号
case 8: grade='B';break;
case 7: grade='C';break;
case 6: grade='D';break;
default: grade='E';break;
}
printf("grade=%c\n",grade);
}
#include
#include
void main ( )
{
float score;
char grade;
printf("请输入成绩%%f\n");
scanf("%f",&score);
switch(int(score/10))
{
case 10:
case 9:
grade = 'A';
break;
case 8:
grade = 'B';
break;
case 7:
grade = 'C';
break;
case 6:
grade = 'D';
break;
default:
grade = 'E';
break;
}
printf("grade=%c\n",grade);
system("pause");
}