当从键盘输入'c'时,以下程序段的输出结果是 。 cin>>n; switch(n) { default: cout<<"errorn";break; case 'a': case 'A':case 'b':case 'B':cout<<"goodn";break; case 'c': case 'C':cout<<"passn"; case 'd': case 'D':cout<<"warnn"; }

当从键盘输入'c'时,以下程序段的输出结果是 。 cin>>n; switch(n) { default: cout<<"errorn";break; case 'a': case 'A':case 'b':case 'B':cout<<"goodn";break; case 'c': case 'C':cout<<"passn"; case 'd': case 'D':cout<<"warnn"; }


参考答案和解析
right

相关考题:

以下程序的运行结果是 【 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");}

( 18 )以下选项中与 if ( a==1 ) a=b; else a++; 语句功能不同的 switch 语句是A )switch ( a ){case : a=b ; break ;default:a++ ;}B )switch ( a==1 ){case 0 : a=b ; break ;case 1 : a++ ;}C )switch ( a ){default : a++ ; break ;case 1 : a=b ;}D )switch ( a==1 ){case 1 : a=b ; break ;case 0 : a++ ;}

执行语句序列 intn: cin>>n: switch(n) { casel: case2:cout<<'1': case 3: case4:cout<<'2': break: delhult:cout<<'3': } 时,若键盘输入1,则屏幕显示A.1B.2C.3D.12

有以下程序 main() { int k=5,n=0; do { switch(k) { case 1: case 3:n+=1;k--;break; default:n=0;k--; case 2: case 4:n+=2;k--;break; } printf("%d",n); }while(k>0n<5); } 程序运行后的输出结果是A.235B.235C.2356D.2356

下面程序的运行结果为#include(iostream.hvoid main(){char a='3‘;switch(a){case '3‘:cout ”3”;case '2’:cout ”2”;break;default:cout ”1”;}}A.32B.321C.31D.3

下面程序的运行结果为 include void main( ) {char a='3'; switch(a) { case'3': 下面程序的运行结果为#include<iostream.h>void main( ){char a='3';switch(a){case'3':cout < <"3";case'2':cout < < "2";break;default:cout < <"1";}}A.3B.321C.31D.32

以下程序段的运行结果是( )。 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"); } }

下面程序的运行结果为()。includevoid main(){char a=‘3’;switch(A) {case’3’:cout 下面程序的运行结果为( )。 #include<iostream.h> void main() { char a=‘3’; switch(A) { case’3’:cout<<“3”; case’2’:cout<<“2”;break; default:cout<<“1”; } }A.3B.321C.31D.32

下程序的输出结果是main( ){int a=0,i;for(i=1;i<5;i++){switch(i){case 0:case 3:a+=2;case 1:case 2:a+=3;default:a+=5;}}cout<<a<<end1;}A.31B.13C.10D.20

以下程序的输出结果是()。includevoid main(){int a(5),b(6),i(0),j(0);switch(a) { 以下程序的输出结果是( )。 #include<iostream.h> void main() { int a(5),b(6),i(0),j(0); switch(a) { case 5:switch(b) { case 5:i++;break; case 6:j++;break; default:i++;j++; } case 6:i++; j++; break; default:i++;j++; } cout<<i<<","<<j<<endl; }A.1,2B.1,3C.2,2D.2,3

以下程序的运行结果是( )。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");}

以下程序执行后的输出结果是【】。includemain(){int i, m=0,n=0,k=0;for(i=9;i 以下程序执行后的输出结果是【 】。include<iostream.h>main(){int i, m=0,n=0,k=0;for(i=9;i<= 11 ;i++)switch(i/10){case 0: m++; n++; break;case 10: n++; break;default: k++; n++;}cout<<m<<n<<k;}

请阅读以下程序main( ){int x=1,y=0,a=0,b=0;switch(x)case 1:switch(y){case 0:a++;break;case 1:b++;break;}case 2:a++;b++;break;}cout<<"a="<<a<<"b="<<b<<endl;}上面程序的输出结果是A.a=2,b=1B.a=1,b=1C.a=1,b=0D.a=2,b=2

下面程序的运行结果为( )。 #include<iostream.h void main() { char a='3'; switch(a) { case'3': cout<<“3”: case'2': cout<<“2”; break; default:cout<<“1”: } }A.3B.321C.31D.32

执行语句序列 int n: cin>>n: switch (n) { case 1: case 2:cout<<'1'; case 3: case 4: cout<<'2': break; default: cout<<'3': }时,若键盘输入1,则屏幕显示A.1B.2C.3D.12

下面程序的输出结果是main(){int a=15, b=21,m=0;switch(a%3){ case 0, m++; break;case 1 :m++; switch(b%2) { default: m++; case 0:m++ ;break; }}cout<<m<<end1}A.1B.2C.3D.4

有下列程序: main() {int k=5,n=0; do {switch(k) {case 1: case 3:n+=1;k--;break; default:n=0;k--; case 2: case 4;n+=2;k--;break; } printf("%d",n); }while(k>On<5); } 程序运行后的输出结果是( )。A.235B.0235C.02356D.2356

有下列程序:main(){int k=5,n=0;do{switch(k){case 1: case 3:n+=1;k--;break;default:n=0;k--;Case 2: case 4;n+=2;k--;break;}printf("%d",n);}while(k>0 n<5) ;}程序运行后的输出结果是( )。A.235B.0235C.02356D.2356

下列程序的输出结果是【】。 include void main() { inta(5),b(6),i(0)1j(0); switch(a 下列程序的输出结果是【 】。include<iostream.h>void main(){inta(5),b(6),i(0)1j(0);switch(a){case 5:switch(b){case 5:i++;break;case 6:j++;break;defaun:i++;j++;}case 6:i++;j++;break;default:i++;j++;}cout<<i<<","<<j<<endl;}

请阅读以下程序 main( ) { int x=1.y=0, a=0, b=0: switch(x) { case 1: switch(y) { case 0: a++; break; case 1: b++; break; } case 2: a++; b++; break; } cout<<"a="<<a<<"b="<<bend1; } 上面程序的输出结果是A.a=2, b=1B.a=1, b=1C.a=1. b=0D.a=2. b=2

下列程序段的输出结果是【】。int n=c; switch(n++) {default:printf(errorc;switch(n++){default:printf(error);break;case a:case A:case b:case B:printf(good);break;case c:caseC:printf(pass);case d:caseD:printf(warn);}

下面程序的运行结果为( )。includeiostream.hvoidmain(){chara=3:switch(a){case3:cout3;case2:cout2;break;default:cout1;}}A.3B.321C.31D.32

执行语句序列: int n; cin>>n; switch(n) { case 1: case 2:cout<<'1'; case 3: case 4:cout<<'2';break; default:cout<<'3'; }时,若从键盘输入1,则屏幕显示______ 。A.1B.2C.3D.12

下面程序的运行结果为( )。 include using namespace std; void main(){ 下面程序的运行结果为( )。 #include<iostream> using namespace std; void main(){ int a=1; switch(a){ case 1:cout<<"1"; case 2:cout<<"2"; break; default:cout<<"0"; } }A.12B.120C.1D.10

以下程序输出的结果是( )。 void main( ) { int x = 1,a =0,b =0; switch(x) { case 0:b ++; case 1: a + +; case 2:a ++ ;b ++; } cout <<a <<b;}A.21B.11C.12D.10

若定义: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";

以下程序的输出结果是 main() {int a=0,i; for(i=1;i<5;i++) {switch(i) {case 0: case 3:a+=2; case 1: case 2:a+=3; default:a+=5; } } cout<<a<<endl; }A.31B.13C.10D.20

下列程序不能通过编译,应该在划线部分填写的语句是______。 include include 下列程序不能通过编译,应该在划线部分填写的语句是______。include<iostream.h>include<stdlib.h>double Func(int a,int b,char ch){double x;switch(ch){case'+':x=double(a)+b;break;case '-':x=double(a)-b;break;case '*':x=double(a)*b;break;case'/':if(B)x=double(a)/b;elseexit(1);break;default:exit(1);}______}void main( ){cout<<Func(32,6,'-')<<",";cout<<Func(32,6, '*')<<",";cout<<Func(32,6,'/')<<endl;}