niusouti.com

运行下面程序时,从键盘输入字母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.

题目
运行下面程序时,从键盘输入字母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!


相似考题
更多“运行下面程序时,从键盘输入字母H,则输出结果是#include<stdio.h>main(){ char ch;ch=getchar();s ”相关问题
  • 第1题:

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


    B 本题中a的值为6,b的值为8,最后s的值为8,s*=s等价于s=s*s。

  • 第2题:

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


    B

  • 第3题:

    如果下列程序正常运行,则当从键盘输入字母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ˊ。

  • 第4题:

    运行下列程序时,从键盘输入字母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参考答案

  • 第5题:

    15、在执行以下程序时,如果从键盘上输入:Gooddef〈回车〉,则输出为()。 #include "stdio.h" main () { char ch; while((ch=getchar())!= '\n') { if(ch >='a' && ch <='z') ch =ch -32; printf("%c", ch); } printf("\n") ; }


    B