中国大学MOOC: 如下代码片段的输出是什么? int a = 1, b = 0; switch (a) { case 1: switch (b) { case 0: printf (**0**); break; case 1: printf (**1**); break; } case 2: printf (**2**); break; }
举一反三
- 下列程序的输出结果是_____________ main() { int a=1,b=0; switch(a) { case 1: switch (b) { case 0: printf("**0**"); break; case 1: printf("**1**"); break; } case 2: printf("**2**"); break; } }
- 设有声明int a=1,b=0;则执行以下语句后的输出结果为______ switch(a){ case 1: switch(b) { case 0:printf("**0**");break; case 1:printf("**1**");break; }break; case 2:printf("**2**");break;}
- 中国大学MOOC: 以下程序输出的结果是()# include <stdio.h>int main(){ int a = 4; switch(a ) { case 0: printf("this is 0\n"); break; case 1: printf("this is 1\n"); break; case 2: printf("this is 2\n"); break; default: printf("this is default\n"); } return 0;
- 中国大学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 j=4;for ( int i=j; i<=2*j; i++ ) { switch ( i/j ) { case 0: case 1: printf(“*”); break; case 2: printf(“#”); }}