【填空题】以下程序的输出结果是 _________ 。 #include void main() { intx=1,y=0,a=0,b=0; switch(x) { case1: switch(y) { case0:a++;break; case1:b++;break; } case2:a++;b++;break; case3:a++;b++; } printf("a=%d,b=%d
",a,b); }
",a,b); }
举一反三
- #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 以上程序的输出是
- 中国大学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(
- 请读程序: #include<stdio.h> 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);} 上面程序的输出结果是( )
- 有以下程序:#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
- #includemain(){intx=1,y=0,a=0,b=0;switch(x){case1:switch(y){case0:a++;break;case1:b++;break;}case2:a++;b++;break;}case2:a++,b++;printf(“a=%d,b=%d”,a,b);}