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

题目内容 (请给出正确答案)

若有以下定义: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,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"); } ” 相关考题
考题 以下程序的运行结果是 【 9 】 。main( ){ int a=2,b=7,c=5;switch(a0){ case 1:switch(b0){ case 1: printf ("@"); break;case 2: printf("!"); break;}case 0: switch(c==5){ case 0 : printf (" * "); break;case 1 : printf(" # "); break;case 2: printf(" $ "); break;}default : printf("");}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");}

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

考题 阅读以下程序includemain(){Int Case;float printF;printf("请输入2个数:");scanf("%d 阅读以下程序 #include<stdio.h> main() {Int Case;float printF; printf("请输入2个数:"); scanf("%d %f",Case,printF); printf("%d%f\n",Case,printF); } 以下说法正确的是( )。A.定义浯句出错,Case是关键字,不能用作用户自定义标识符,printF不能用作用户自定义标识符B.定义语句出错,Int无法被识别C.定义语句无错,scanf不能作为输入函数使用D.定义语句无错,printf不能输出Case的值

考题 以下程序段的运行结果是( )。 include main() {int x=2,y=1: switch(x) {case 1: switch 以下程序段的运行结果是( )。 include<stdio.h> main() {int x=2,y=1: switch(x) {case 1: switch(y) {case 0:printf("x=2,y=1\n");break; case 1:printf("y=1\n");break; } case 2:printf("x=2\n"); } }

考题 若有定义:inta=5,*b=,则printf("%d\n",*b);语句的输出结果为()。A.随机值B.a的地址C.6D.5

考题 以下选项中与“if(a= =l)a=b;else a++;”语句功能不同的switch语句是( )。A.switch(a) {case l:a=b;break; default:a++; }B.switch(a= =l) {case 0:a=b;break; case l:a++; }C.switch(a) {default:a++;break; case l:a=b; }D.switch(a= =l) {case l:a=b;break; case 0:a++; }

考题 以下程序的运行结果是( )。main()(int a=2,b=7,c=5;switch(a>0){case 1:switch(b<0){case 1:switch(");break;case 2:printf("!");break;}case 0:switch(c==5){case 0:printf("*");break;case 1:printf("");break;case 2:printf("$");break;}default:printf ("&");}printf("\n");}

考题 若有以下定义,则正确的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=1,b=0;,则执行以下语句的输出结果是______。 switch(a) {case 1: switch(b) {case 0:printf("**0**\n");break; case 1:printf("**1*\n");break; } case 2:printf("**2**\n");break; }A.**0**B.**0** **2**C.**0** **1** **2**D.switch语句中存在语法错误

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

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

考题 若有如下程序: main() {int x=9,y=4,n=0; switch(x%2) {case 0:n++;break; case 1:n++; case 0:n++;break; } printf("%d\n",n); } 则程序运行后的输出结果是( )。A.1B.2C.3D.编译错误

考题 若有下列定义(设int类型变量占2个字节): floatx=123.4567; 则下列语句: printf("x=%5.2f",x); 输出的结果是( )。A.x=123.46B.123.4567C.x=123.4567D.123.46

考题 若有以下定义,则正确的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语句是( )。

考题 若a、b、c1、c2、x、y均是整型变量,则正确的switch语句是( )。A.switch(a+b); { casel:y=a+b;break; case0:y=a-b;break; }B.switch(a*a+b*b) { case 3: case 1:y=a+b;break; case 3:y=b-a;break; }C.switch a {case c1:y=a-b;break; case c2:x=a*d;break; default:x=a+b; }D.switch(a-b) {default:y=a*b;break; case 3:case 4:x=a+b;break; case 10:case 11:y=a—b;break; }

考题 若有定义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");}

考题 若有定义: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"); case2: 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: printf("**\n"));}

考题 若以下选项中的变量全部为整型变量,且已正确定义并赋值,则语法正确的switch语句是( )。A.switch(a+9) {case cl:y=a-b; case c2:y=a+b; }B.switch a*b {case l0:x=a+b; default:y=a-b; }C.switch(a+b) {casel:case3:y=a+b;break; case0:case4:y=a-b; }D.switch(a*a+b*b) {default:break; case 3:y=a+b;break; case 2:y=a-b;break; }

考题 若有定义:floatx=2,y;inta=3;语句y=1*(x+A./3;运行后,y的值为()。A.2.0B.1.0C.0D.1.666667

考题 若有定义语句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++; }

考题 若定义: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"); }

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