单选题 若有定义:float x=1.5;int a=1,b=3,c=2;则正确的switch语句是______。
A) switch(x) B) switch((int)x);
case 1.0:printf("*/n"); case 1:printf("*/n");
case 2.0:printf("**/n"); case 2:printf("**/n");
C) switch(a+b) D) switch(a+b)
case 1;printf("*/n"); case 1:printf("*/n");
case 2+1:printf("**/n"); case c:printf("**/n");)

【正确答案】 C
【答案解析】[解析] switch-case结构中,case后面必须是整数或者字符常量。因此选项A、D都错。而B中switch后面不能有分号。注意,(2+1)是一个常量。