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

运行下列程序时,从键盘输入字母H,则输出结果是()。 #include <stdio.h> int main() { char ch; ch=getchar(); switch(ch) { case 'H':printf("Hello!n"); case 'G':printf("Good morning!n"); default:printf("Good Bye!n"); } }

A.Hello!

B.Hello! Good morning!

C.Hello! Good morning! Good Bye!

D.Hello! Good Bye!


参考答案和解析
C参考答案

相关考题:

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

请补充函数fun(),该函数的功能是:返回字符数组中指定子符的个数,指定字符从键盘输入。注意:部分源程序给出如下。请勿改动主函数main和其他函数中的任何内容,仅在函数fun()的横线上填入所编写的若干表达式或语句。试题程序:include <stdio.h>define N 80int fun (char s[],char ch){int i=0, n=0;while(【 】){if(【 】)n++;i++;}【 】;}main ( ){int n;char str[N], ch;clrscr ();printf ("\nInput a string: \n");gets (str);printf ("\nInput a charactor: \n" ;scanf ("%c", ch);n=fun (str, ch);printf("\nnumber of %c:%d", ch, 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

有以下程序:includeunion pw{int i; char ch[2];}a;main(){a.ch[0]=13;a.ch[1]=0;prin 有以下程序: #include<stdio.h> union pw { int i; char ch[2]; }a; main() { a.ch[0]=13;a.ch[1]=0;printf("%d\n",a.i);} 程序的输出结果是( )。A.13B.14C.208D.209

有以下程序: 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

有以下程序includemain(){int k=5,n=0;while(k>0){switch(k){defhult:break;case 1:n+ 有以下程序 #include<stdio.h> main() {int k=5,n=0; while(k>0) {switch(k) {defhult:break; case 1:n+=k: case 2: case 3:n+=k; } k--; } printf("%d\n",n); } 程序运行后的输出结果是( )A.0B.4C.6D.7

要求通过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):

若执行下列程序时从键盘上输入2,则输出结果是()。 inclUde main() {int a; scanf("%d", 若执行下列程序时从键盘上输入2,则输出结果是( )。#inclUde<stdio.h>main(){int a;scanf("%d",A);if(a++<3)printf("%d\n",A);else printf("%d\n",a--);}A.1B.3C.2D.4

下列程序运行时,若输入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

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

有以下程序: include main ( ) {int k=5,n =0; while ( k>0){switch (k) {default: b 有以下程序: #include <stdio, h>main ( ) { int k=5,n =0; while ( k>0) { switch (k) { default: break; case 1 : n+ =k; case 2 : case3 : n+ =k; } k--; printf( "% d \n" ,n);}程序运行后的输出结果是( )。A.0B.4C.6D.7

有以下程序:includemain(){char k; int i; for(i=1;i 有以下程序: #include <stdio.h> main() { char k; int i; for(i=1;i<3;i++) { scanf("%c",k); switch(k) { case '0': printf("another\n"); case '1': printf("number\n"); } { } 程序运行时,从键盘输入:01<回车>,程序执行后的输出结果是( )。A.another numberB.another number anotherC.another numberD.number number

在执行以下程序时,如果从键盘上输入: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