题目内容

两次运行下面的程序,如果从键盘上分别输入3和2,则输出结果是( )#includeint main(){int x;scanf("%d",&x);if(x++>2)printf("%d",x);elseprintf("%d",x--);return 0;}

A. 4和3
B. 4和2
C. 4和1
D. 3和2

查看答案
更多问题

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

答案查题题库