早教吧 育儿知识 作业答案 考试题库 百科 知识分享

若有定义floatw;inta,b;,则合法的switch语句是()。(1分)A、switch(w){case1.0:printf("*\n");case2.0:printf("**\n");}B、switch(a);{case1printf("*\n");case2printf("**\n");}C、switch(b){case1:printf("*\n");d

题目详情
若有定义float w; int a, b; ,则合法的switch语句是( )。(1分)
A、switch(w) { case 1.0: printf("*\n"); case
2.0: printf("**\n"); }
B、switch(a); { case 1 printf("*\n"); case 2
printf("**\n"); }
C、switch(b) { case 1: printf("*\n"); default:
printf("\n"); case 1+2: printf("**\n"); }
D、switch(a+b); { case 1: printf("*\n"); case
2: printf("**\n"); default: printf("\n"); }
▼优质解答
答案和解析
a 缺少default
b switch后有;
c 合法
d 同b