出错了
#include"stdio.h"void main()
{
float score;
char grade;
printf("请输入学生成绩:");
scanf("%f",&score);
while(score>100||score<0)
{printf("\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;
case 5:
case 4:
case 3:
case 2:
case 1:
case 0:grade='E';
}
printf("成绩是 %5.lf,相应的等级是%c。\n",score,grade);
}
--------------------Configuration: 1 - Win32 Debug--------------------
Compiling...
1.cpp
E:\程序\1.cpp(15) : error C2046: illegal case
E:\程序\1.cpp(16) : error C2046: illegal case
E:\程序\1.cpp(17) : error C2046: illegal case
E:\程序\1.cpp(18) : error C2046: illegal case
E:\程序\1.cpp(19) : error C2046: illegal case
E:\程序\1.cpp(20) : error C2046: illegal case
E:\程序\1.cpp(21) : error C2046: illegal case
E:\程序\1.cpp(22) : error C2046: illegal case
E:\程序\1.cpp(23) : error C2046: illegal case
E:\程序\1.cpp(28) : fatal error C1004: unexpected end of file found
执行 cl.exe 时出错.
1.exe - 1 error(s), 0 warning(s)
咋回事啊,书上是这么个答案!!!
[[it] 本帖最后由 小小熊宝宝 于 2008-8-16 22:47 编辑 [/it]]