若有以下定义,则正确的swish语句是______。 float x;int a,b;

admin2013-02-23  27

问题 若有以下定义,则正确的swish语句是______。    float x;int a,b;

选项 A、switch(x)   {case 1.0:printf("*\n");    case 2.0:printf("**\n");   }
B、switch(x)   {case 1,2:printf("*\n");    case 3:printf("**\n");   }
C、switch(a+b)   {case 1:printf("\n");    case 1+2:printf("**\n");   }
D、switch(a+b);   {case 1:printf("*\n");    case 2:printf("**\n");   }

答案4

解析 switch后必须是整型或字符型的表达式,因此选项A、B错误;表达式的括号外没有分号,因此选项D错误。
转载请注明原文地址:https://kaotiyun.com/show/UiPp777K
0

最新回复(0)