有以下程序:#includeint main(){int a=1,b=2,c=3,d=0;if(a==1&&b++==2)if(b!=2||c--!=3)printf("%d,%d,%d\n",a,b,c);else printf("%d,%d,%d\n",a,b,c);else printf("%d,%d,%d\n",a,b,c);return 0;}
A. 1,2,3
B. 1,3,2
C. 1,3,3
D. 3,2,1
查看答案
以下程序的运行结果是( )#includeint main(){int a=-5,b=1,c=1;int x=0,y=2,z=0;if(c>0)x=x+y;if(a<=0){if(b>0)if(c<=0)y=x-y;}else if(c>0)y=x-y;elsez=y;printf("%d,%d,%d",x,y,z);return 0;}
A. 2,2,0
B. 2,2,2
C. 0,2,0
D. 2,0,2
两次运行下面的程序,如果从键盘上分别输入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