有下面程序,从键盘输入字母H,则输出结果是( )#include int main(){char ch;ch=getchar();switch(ch){case 'H':printf("Hello!\n");case 'G':printf("Good morning!\n");default:printf("Bye_Bye!\n");}return 0;}
A. Hello!
B. Hello!Good morning!
C. Hello!Good morning!Bye_Bye!
D. Hello!Bye_Bye!
查看答案
有以下程序:#includeint main(){int x=1,y=0;if(!x)y++;else if(x==0)if(x)y+=2;else y+=3;printf("%d\n",y);return 0;}
A. 3
B. 2
C. 1
D. 0
有如下程序:#include int main(){int m=1,a=0,b=0;switch(m){case 0:b++;case 1:a++;case 2:a++;b++;}printf("a=%d,b=%d\n",a,b);return 0;}该程序的输出结果是( )
A. a=2,b=l
B. a=l,b=l
C. a=l,b=0
D. a=2,b=2
有以下程序#includeint 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;case 3:a++,b++;}printf("a=%d,b=%d\n",a,b);return 0;}程序运行的结果是( )
A. a=2,b=2
B. a=2,b=1
C. a=1,b=1
D. a=1,b=0
若变量a,b,c都为整数,且a=1,b=15,c=0,则表达式a==b>c的值是().
A. 0
B. 非零
C. “真”
D. 1