求教看到的人,帮我解释下!
#include <stdio.h>void main()
{
float score;//如果用浮点型就会报错 我知道switch的表达式必须是整型或者字符型 但是为什么浮点型不得呢 ?例如输入一些浮点数据判断它等级怎么办?
scanf("%d",&score);
switch(score/10)
{
case 10:
case 9:printf("youre score is A\n",score);break;
case 8:printf("your score is B\n");break;
case 7:printf("your score is C\n");break;
case 6:printf("your score is D\n");break;
case 5:printf("your score is E\n");break;
default:printf("your score is F\n");
}
}