请读程序: #include main() {int x=l,y=0,a=0,b=0; switch(x) {case l: switch(y) {case 0: a++; break; case 1:b++;break;} case 2: a++;b++; break;} printf("a=%d, b=%dn",a,b);} 上面程序的输出结果是( )
举一反三
- 中国大学MOOC: 读下列程序:void 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; } printf(
- 中国大学MOOC: 下面程序的输出是( ) 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; }
- #include main() {int x=1,y=0,a=0,b=0; switch(x) {case 1: switch(y) {case 0:a++;break; case1:b++;break;} case 2:a++;b++;break; case 3:a++;b++;break; default:a++;b++;} printf(“a=%d,b=%d”,a,b);} A.a=1,b=0 B.a=2,b=1 C.a=1,b=1 D.a=2,b=2 以上程序的输出是
- #include <;stdio.h>;int main(){int x=1,a=0,b=0;switch(x){case 0:b++;break;case 1: a++;case 2: a++;b++;}printf("a=%d,b=%d\n",a,b);return 0;}程序输出结果:
- 有以下程序:#include void 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”, a, b);}程序的运行结果是__。 A: a=2,b=2 B: a=2,b=1 C: a=1,b=1 D: a=1,b=0