有如下程序段:int x; scanf("%d",&x); switch ( x ) { case 9: x++; break; case 10: x++; case 11: x++; break; default: x++; }如果最初输入的x的值为10,则switch语句结束后x的值为________,
A: 10
B: 11
C: 12
D: 13
A: 10
B: 11
C: 12
D: 13
举一反三
- 中国大学MOOC: 有如下程序段:int x;scanf("%d",&x);switch ( x ) { case 9: x++; break; case 10: x++; case 11: x++; break; default: x++;}如果最初输入的x的值为10,则switch语句结束后x的值为________,
- 中国大学MOOC: 有如下程序段:int x; scanf(%d,&x); switch ( x ) { case 9: x++; break; case 10: x++; case 11: x++; break; default: x++; }如果最初输入的x的值为10,则switch语句结束后x的值为________,
- 若int x=10; 执行下列程序后,变量x的正确结果是( )。 switch ( ) { case 9: x++; case 10: x++; break;<br/>case 11: x++; default: x++; } A: 10 B: 11 C: 12 D: 13
- 中国大学MOOC: 若int x=10; 执行下列程序后,变量x的正确结果是 。switch ( x ) { case 9: x++; case 10: x++; case 11: x++; break; default: x++; }
- 有如下程序段: int x =1, y=1 ; int m , n; m=n=1; switch (m) { case 0 : x=x*2; case 1: { switch (n) { case 1 : x=x*2; case 2 : y=y*2;break; case 3 : x++; } } case 2 : x++;y++; case 3 : x*=2;y*=2;break; default:x++;y++; } 执行完成后,x和y 的值分别为( )。