运行下面程序,输出结果是 。#include int main(){int n=0,m=1,x=2;if(!n) x-=1;if(m) x-=2;if(x) x-=3;printf (“%d\n”,x);return 0;}
A. 1
B. -4
C. 0
D. -1
有如下程序:#include int main(){int a=5,b=4,c=3,d=2;if(a>b>c)prinft(“%d\n”,d);else if((c-1>=d)==1)printf (“%d\n”,d+1);else printf (“%d\n”,d+2);return 0;}
A. 2
B. 3
C. 4
D. 编译出错
有如下程序:#include int main(){int x=1,a=0,b=0;switch(x){case 0: b++;case 1: a++;case 2: a++;b++;}printf("a=%d,b=%d\n",a,b);return 0;}
A. a=2,b=1
B. a=1,b=1
C. a=1,b=0
D. a=2,b=2
下列程序段的输出结果是。#include int main(){ int a=0,b=0,c=0,d=0;if((a=1) b=1;c=2;else d=3;printf(“%d,%d,%d,%d\n”,a,b,c,d);return 0;}
A. 0,1,2,0
B. 0,0,0,3
C. 1,1,2,0
D. 编译有错