以下程序的运行结果是____。#include <stdio.h>void main(){ int x=1,a=0,b=0;switch(x){ case 0: b++;case 1: a++;case 2: a++;b++;}printf("%d %d",a,b);}
举一反三
- 以下程序的运行结果是____。#include <stdio.h>void main(){ int x=1,a=0,b=0;switch(x==0){ case 0: b++;case 1: a++;breakcase 2: a++;b++;}printf("%d %d",a,b);}
- 下面程序的运行结果是_______。 #include int main( ) { int x = 1 , a = 0 , b = 0 ; switch( x ) { case 0 : b++ ; case 1 : a++ ; case 2 : a++ ; b++ ; } printf( "%d,%d" , a , b ) ; return 0 ; }
- 请输出以下程序的运行结果()。void 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",a,b);}
- void 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",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