下面程序段的输出结果是______。 int n= int n='c'; switch(n++) {default: printf("error"); break; case 'a': case 'A': case 'b': case 'B': printf("good"); break; case 'c': case 'C': printf("pass"); case 'd': case 'D': printf("warn"); }
举一反三
- 中国大学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;
- #include main()_ { char grade=’C’; switch(grade) { case ‘A’: printf(“90-100\n”); case ‘B’: printf(“80-90\n”); case ‘C’: printf(“70-80\n”); case ‘D’: printf(“60-70\n”); break; case ‘E’: printf(“<60\n”); default : printf(“error!\n”); } } 运行结果为( )
- 下列程序的输出结果是_____________ 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; } }
- 4-12、设有程序段: switch(grade) { case ‘A’: printf(“85-100\\”); case ‘B’: printf(“70-84\\”); case ‘C’: printf(“60-69\\”); case ‘D’: printf(“<60\\”); default: printf(“error!\n”); } 若grade的值为‘C’,则输出结果是________。
- switch(a){ case 1:printf(“Monday\n"); case 2:printf("Tuesday\n"); case 3:printf(“Wednesday\n"); case 4:printf("Thursday\n"); case 5:printf("Friday\n");break; case 6:printf("Saturday\n"); case 7:printf("Sunday\n"); } 若a的值为6,请问运行结果为: