若有以下定义: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"); }

若有以下定义: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"); }


相关考题:

设已有定义: float x; 则以下对指针变量 p 进行定义且赋初值的语句中正确的是A)float *p=1024;B)int *p=(float)x;C)float p=x;D)float *P=x;

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

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

若有定义语句int a,b;double x;则下列选项中没有错误的是( )。A.switch(x%2) {case O:a++;break; case 1:b++;break; default:a++;b++; }B.switch((int)x/2.0) {case O:a++;break; case 1:b++;break; default:a++;b++; }C.switch((int)x%2) {case O:a++;break; case 1:b++;break; default:a++;b++; }D.switch((int)(x)%2) {case 0.O:a++;break; case 1.0:b++;break; default:a++;b++; }

若有定义语句“int a,b;double X;”,则下列选项中没有错误的是( )。A.switch(X%2) { case 0:a++;break; case l:b++;break; default:a++;b++; }B.switch((int)x/2.O) { case 0:a++;break; case l:b++;break; default:a++;b++; }C.switch((int)X%2) { case 0:a++;break; case l:b++;break; default:a++;b++; }D.switch((int)(x)%2) { case 0.0:a++;break; case l.0:b++;break; default:a++;b++; }

设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 型变量 a、b,float 型变量 x、y,char 型变量 ch 均已正确定义并赋值,正确的switch语句是()A.switch (x + y) { ...... }B.switch (ch + 1 ) { ...... }C.switch ch { ...... }D.switch (a + b ); { ...... }

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

设已有定义float x;,则以下对指针变量p进行定义其赋初值的语句中正确的是()A.float *p=1024;B.float *p=x;C.int *p=(int)x;D.float p=x;

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