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

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

如果下列程序正常运行,则当从键盘输入字母A时,输出结果为()。  #include <stdio.h>  main()     {  char ch;       ch=getchar();      switch(ch)      {  case 65: printf(“%c”, ‘A’);       case 66: printf(“%c”, ‘B’);       default: printf(“%s”, “other”);    }    }

A.A

B.AB

C.ABother

D.不确定


参考答案和解析
D scanf函数读取的是char型数据,所以回车时输入的换行符也是有效字符。于是c1,c2,c3,c4的内容分别是1,2,3,ˊ\nˊ。
更多 “如果下列程序正常运行,则当从键盘输入字母A时,输出结果为()。  #include <stdio.h>  main()     {  char ch;       ch=getchar();      switch(ch)      {  case 65: printf(“%c”, ‘A’);       case 66: printf(“%c”, ‘B’);       default: printf(“%s”, “other”);    }    }A.AB.ABC.ABotherD.不确定” 相关考题
考题 以下程序的运行结果是 【 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");}

考题 下列程序运行时,若输入labced12df回车 输出结果为【10】#include stdio.hmain( ){char a =0,ch;while((ch=getchar())!=’\n’){if(a2!=0(ch’a’ch=’z’)) ch=ch-‘a’+’A’;a++;putchar(ch);}printf(“\n”);}

考题 要求通过 while 循环不断读入字符 , 当读入字母 N 时结束循环 。 若变量已正确定义 , 以下正确的程序段是A)while((ch=getchar())!='N') printf(" % c",ch);B)while(ch=getchar()!='N') printf(" % c",ch);C)while(ch=getchar()=='N') printf(" % c",ch);D)while((ch=getchar())=='N') printf(" % c",ch);

考题 运行下面程序时,从键盘输入字母H,则输出结果是#includestdio.hmain(){ char ch;ch=getchar();switch(ch){case ′H′:printf("Hello!\n");case ′G′:printf("Good morning!\n");default:printf("Bye_Bye!\n");}}A.Hello!B.Hello! Good Moring!C.Hello! Good morning! Bye_Bye!D.Hello! Bye_Bye!

考题 要求通过while循环不断读入字符,当读入字母N时结束循环。若变量已正确定义,下列正确的程序段是( )A.while((ch=getchar ())!='N')printf("%c",ch);B.while(ch=getchar()!='N') printf("%c",ch);C.while(ch=getchar()=='N') printf("%c",ch);D.while((ch=getchar()) =='N')printf('%c',ch);

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

考题 在执行以下程序时,如果从键盘上输入ABCdef,则输出为______。include main(){char 在执行以下程序时,如果从键盘上输入ABCdef<回车>,则输出为______。#include <stdio.h>main (){ char ch; while ((ch=getchar())!="\n") { if (ch>='A' ch<='B')ch=ch+32; else if (ch>='a' ch<='z')ch=ch-32; printf("%c",ch); } printf("\n");}A.ABCdefB.abcDEFC.abcD.DEF

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

考题 执行下面的程序时,输入abc(其中CR代表回车),输出结果是()。includeinclude 执行下面的程序时,输入abc<CR>(其中CR代表回车),输出结果是( )。 #include<stdio.h> #include <string.h> main() { char ch; while((cn=getchar())!='n') { switch(ch-'a') { case 0: putchar(ch+1); case 1:putchar(ch+1);break; case 2:putchar(ch+2); caSe 3:putchar(ch+2);break; } } }A.abcB.bbcC.abcdD.bbcee

考题 以下程序的输出结果是()。includecharcchar(chareh){if(ch>='A,ch 以下程序的输出结果是( )。 #include <stdio.h> charcchar(char eh) { if(ch>='A,ch<='Z') ch=ch-'A'+'a'; return ch; } main() { char s[]="ABC+abc=defDEF",*p=s; while(*p) { *p=cchsr(*p); p++; } printf("%s\n",s); }A.abc+ABC=DEFdefB.abc+abc=defdefC.abcABCDEFdefD.abcabcdefdef

考题 有以下程序: include main ( ) int i;for(i =0;i 有以下程序: #include <stdio.h> main ( ) int i; for(i =0;i <3 ;i ++ ) switch (i) case 0: printf(" % d" ,i); case 2: printf(" % d" , i); default: printf( "% d" , i);程序运行后的输出结果是( )。A.22111B.21021C.122D.12

考题 要求通过while循环不断读入字符,当读入字母N时结束循环。若变量已正确定义,以下正确的程序段是( )。A.while((ch=getchar())!='N')printf("%c",ch);B.while(ch=getchar()!='N')printf("%c",ch);C.while(ch=getchar()=='N')printf("%c",ch);D.while((ch=getchar())=='N')printf("%c",ch):

考题 下列程序运行时,若输入labcedf2df输出结果为【】。 include main(){char a=0,ch; wh 下列程序运行时,若输入labcedf2df<回车>输出结果为【 】。include<stdio.h>main(){ char a=0,ch;while((ch==getchar())!='\n'){ if(a%2!=0(ch>='a'ch<='z')) ch=ch'a'+'A';a++;prtchar(ch);}printf("\n");}

考题 有如下程序includemain(){int v1=0,v2=0; char ch; while((ch=getchar())!='') switc 有如下程序 #include<stdio.h> main() { int v1=0,v2=0; char ch; while((ch=getchar())!='#') switch(ch) { case 'a'; casff 'h'; default:v1++; case '0';v2++; } printf("%d,%d\n",v1,v2); } 如果从键盘上输入china#<回车>,则程序运行结果为 ( )A.2,0B.5,0C.5,5D.2,5

考题 运行以下程序后,如果从键盘上输入shose后回车,则输出结果为 _______。 includevoid 运行以下程序后,如果从键盘上输入shose后回车,则输出结果为 _______。 # include<iostream.h> void main(){ int v1=0,v2=0,k=0; char ch[80]; cin>>ch; while(ch[k]){ switch(ch[k]){ case 's'; case 'h'; default: v1++1; case 'o': v2++; } k++; } cout<<v1<< ","<<v2<<end1; }A.2, 0B.5, 0C.4, 5D.2, 5

考题 以下程序运行后的输出结果是( )。 include main() {char ch[]="abcd",x[4][4];int i; f 以下程序运行后的输出结果是( )。 include<string.h> main() {char ch[]="abcd",x[4][4];int i; for(i=0;i<4;i++)strcpy(x[i],ch); for(i=0;i<4;i++)printf("%s",x[i][i]); printf("\n"); }

考题 要求通过while循环不断读入字符,当读入字母N时结束循环,若变量已正确定义,下列正确的程序段是( )。A.while((ch—getchar)!=N)printf("%c",ch);B.while(oh=getchar!=N)printf("%c",ch);C.while(ch=getchar==N)printf("%c",ch);D.while((ch—getchar)==N)printf("%c",ch);

考题 运行下面程序时,从键盘输入字母H,则输出结果是includemain(){ char ch;ch=getchar();s 运行下面程序时,从键盘输入字母H,则输出结果是 #include<stdio.h> main() { char ch; ch=getchar(); switch(ch) { case 'H':printf("Hello!\n"); case 'G':printf("Good morning!\n"); default:printf("Bye_Bye!\n"); } }A.Hello!B.Hello! GoodMoring!C.Hello! Goodmorning! Bye_Bye!D.Hello! Bye_Bye!

考题 有以下程序: include main() {char ch1,ch2;int n1,n2;ch1=getchar();ch2=getehar();n1 有以下程序:include <stdio.h>main(){ char ch1,ch2;int n1,n2;ch1=getchar();ch2=getehar();n1=ch1-'0'; n2=n1*10+(ch2-'0');printf("%d\n",n2);}程序运行时输入:12<回车>,执行后的输出结果是【 】。

考题 运行以下程序后,如果从键盘上输入china,贝愉出结果为_______。includemain(){in 运行以下程序后,如果从键盘上输入china#<回车>,贝愉出结果为_______。 #include<stdio.h> main() { int v1=0,v2=O;char ch; while((ch=getchar())!='#') switch(ch) { case'a': case'h': default:v1++; case'O':v2++; } printf("%d,%d\n",v1,v2); }A.2,0B.5,0C.5,5D.2,5

考题 运行下面程序时,从键盘输入字母H,则输出结果是 main() { char ch; ch=getchar(); swimh(ch) {case'H':printf("Hello!\n"); case'G':printf("Good morning!\n"); default:printf("Bye_Bye!\n"); } }A.Hello!B.Hello! GoodMoring!C.Hello! Good moming! Bye_ye!D.Hello! Bye_ye!

考题 下列程序段的输出结果是【】。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);}

考题 在执行以下程序时,如果从键盘上输入:ABCdef,则输出为______。 main() { char ch; while((ch 在执行以下程序时,如果从键盘上输入:ABCdef<回车>,则输出为______。 main() { char ch; while((ch=getchar())!='\n') { if(ch>='A' ch<='Z') ch=ch+32; else if(ch>='a'ch<='2')ch=ch-32; printf("%c",ch); } printf("\n"); }A.ABCdefB.abcDEFC.abcD.DEF

考题 运行以下程序后,如果从键盘上输入china,则输了结果为______。include main (){ 运行以下程序后,如果从键盘上输入china#<回车>,则输了结果为______。 #include <stdio. h> main () { int v1=0, v2=0; char ch ; while ((ch=getchar()) !='#') switch (ch) { case 'a': case 'h': default:vi++; case '0':v2++; } printf ("%d, %d\n",v1,v2); }A.2,0B.5,0C.5,5D.2,5

考题 以下程序的输出结果为()。main( ){ char c;int i;for(i=65;i68;i++){ c=i+32;switch(c){ case 'a':case 'b':case 'c':printf("%c,",c);break; default:printf("end");}}}A a,b,c,endB a,a,a,endC a,a,a,D a,b,c,

考题 单选题有如下程序:#include void convert(char ch){ if(ch'D')convert(ch+1); printf(%c,ch);}main(){ convert('A'); printf(%);}程序运行后的输出结果是(  )。A ABCDDCBAB ABCDC AD DCBA

考题 单选题要求通过while循环不断读入字符,当读入字母N时结束循环。若变量已正确定义,以下正确的程序段是()A while((ch=getchar())!=’N’)printf(”%c”,Ch);B while(ch=getchar()!=’N’) printf (”%c”,Ch);C while(ch=getchar()==’N’) printf (”%c”,Ch);D while((ch=getchar())==’N’) printf (”%c”,Ch);

考题 单选题有以下程序:#include main(){ char ch[3][5] = {AAAA,BBBB,CC}; printf(%s,ch[1]);}程序运行后的输出结果是(  )。A AAAAB CCC BBBCCD BBBB