网友您好, 请在下方输入框内输入要搜索的题目:

题目内容 (请给出正确答案)
单选题
若有定义:float x=1.5; int a=1,b=3,c=2; 则正确的switch语句是(  )。

参考答案

参考解析
解析:
D项正确,标号可以是整型表达式。A项错误,case是关键字,与其后面的常量表达式合称case语句标号。常量表达式的类型必须与swicth后圆括号中的表达式类型相同,各case语句标号的值应该互不相同。c是变量,不能作为表达式放在case后面;B项错误,switch后面不应该有分号;C项错误,switch参数值类型必须是这几种类型之一:int,long,short,byte,char。答案选择D选项。
更多 “单选题若有定义:float x=1.5; int a=1,b=3,c=2; 则正确的switch语句是(  )。” 相关考题
考题 若有以下定义和语句union data{ int i; char c; float f; } x;int y;则以下语句正确的是A)x=10.5;B)x.c=101;C)y=x;D)printf("%d\n",x);

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

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

考题 若有定义:int a=7;float x=2.5,y=4.7;则表达式x+a%3*(int)(x+y)%2/4的值是A.2.500000B.2.750000C.3.500000D.0.000000

考题 若有定义语句:int x=3,y=2,z=1;则表达式x <y?x:y的值是______。

考题 若有以下定义,则正确的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"); }

考题 若有以下定义:float x;int a,b; 则错误的switch语句是________。 A. switch(x){case 1.0:printf("*\n"); case 2.0:printf("*\n"); }B. switch(a){case 1:printf("*\n");case 2: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"); }

考题 设int型变量a、b,float型变量x、y,char型变量ch均已正确定义并赋值,正确的switch语句是_________。 A.switch(ch+1){......}B.switch(a+b){......}C.switch(x+y){......}D.switchch{......}

考题 若有定义float X=1.5;int a=1,b=3,C=2;,则正确的switch语句是( )。A.B.C.D.

考题 若有定义:int x=1,y=2;float a=3.7,b=2.1;则(x+y)%2+(int)a/(int)b表达式的值为( )。

考题 若有定义:float x=1.5;int a=1,b=3,c--2;,则正确的switch语句是( )。 .A.AB.BC.CD.D

考题 若有定义:int a=2,b=3;floatx=3.5,y=2.5;则表达式(float)(a+b)/2+(int)x%(int)y的值是() A.3.5B.3.0C.2.5D.2.0

考题 若有以下定义,则正确的switch语句是______。float x;int a,b;A.switch(x) { case 1.0:printf("*\n"); csse 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"); }

考题 若有定义:float x=1.5;int a=1,b=3,c=2;则正确的switch语句是( )。

考题 若有定义:float x=1.5;int a=1,b=3,c=2;则正确的swish语句是( )。

考题 设int型变量a、b,float型变量x、y,char型变量ch均已正确定义并赋值,则正确的swith语句是( )。A.switch (x+y) {...}B.switch (ch+1) {...}C.switch ch {...}D.switck (a+b) {...}

考题 若有定义float x=1.5;int a=1,b=3,c=2;,则正确的switch语句是A.swimh(x) {case 1.0:printf("*\n"); case 2.0:printf("**\n");}B.switch((int)x); {case 1:printf("*\n"); case 2:printf("**\n");}C.switch(a+D. {case 1:pfintf("*\n"); case 2+1:pfintf("**\n");}switch(a-I-{case 1:pfintf("*\n"); case c:printf("**\n");}

考题 若有定义:int a=2,b=3;float x=3.5,y=2.5;则下面表达式的值为______。(float)(a+b)/2+(int)x%(int)yA.3.5B.35C.3.5D.35

考题 若有以下定义:float x;int a,b,c=2;,则正确的switch语句是( )A.switch(x) { case 1.0:printf("*\n"); case 2.0:printf("**\n"); }B.switch(int(x)) { case 1:printf("*\n"); case 2:printf("**\n"); }C.switch(a+b) { case 1:printf("*\n"); case 1+2:printf("**\n"); }D.switch(a+B){ case 1:printf("*\n"); case c:printf("**\n"); }

考题 若定义:float x;int a,b;,则正确的switch语句是( )。A.switch(x) { case1.0:cout<<"*\n"; case2.0:cout<<"**\n";B.switch(x) { case 1.2:cout<<"*\n"; case 3:cout<<"**\n"; }C.switch(a+b) { case 1.0:cout<<"*\n"; case 1+2:cout<<"**\n ";D.switch(a+b) { case 1:cout<<"*\n"; case 2:cout<<"**\n";

考题 若有定义:float x=1.5;int a=1,b=3,c=2; 则正确的switch语句是( )。A.switch(x) { case 1.0: printf("*\n"); case 2.0: printf(" * * \n" );B.switch((iht)x); { case 1: printf(" * \n" ); case 2: printf(" * * \n" ); }C.switch(a +b) { case 1: printf(" * \n" ); case 2 + 1: printf(" * * \n" ); }D.switch(a + b) { case 1: pfintf(" * \n" ); case c: pfintf(" * * \n"); }

考题 设int型变量a、b,float型变量x、y,char型变量ch均已正确定义并赋值,正确的switch语句是( )。A.switch(x+y){……}B.switch(ch+1){……}C.switch ch{……}D.switch(a+b):{……}

考题 若有定义:int x=2,y=3;float i;则以下符合C语言语法的表达式是()A、x=x*3=2B、x=(y==1)C、i=float(x)D、i%(-3)

考题 设int型变量a、b,float型变量x、y,char型变量ch均已正确定义并赋值,正确的switch语句是()。A、switch(x+y){……}B、switch(ch+1){……}C、switch ch{……}D、switch(a+b){……}

考题 若有定义 class A{int x,y; static float f(int a){…} float g(int x1,int x2){…}} 及A a1=new A( );则下列用法中非法的是( )。A、g(3,2)B、f(3)C、a1.f(4)D、a1.g(2,5)

考题 单选题若有定义 class A{int x,y; static float f(int a){…} float g(int x1,int x2){…}} 及A a1=new A( );则下列用法中非法的是( )。A g(3,2)B f(3)C a1.f(4)D a1.g(2,5)

考题 单选题若有定义:int x=2,y=3;float i;则以下符合C语言语法的表达式是()A x=x*3=2B x=(y==1)C i=float(x)D i%(-3)