#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”); } } 运行结果为( )
举一反三
- 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,请问运行结果为:
- 若输入B,以下程序的运行结果为()。main(){chargrade;scanf("%c",&grade);switch(grade){case'A':printf(">=85");case'B':case'C':printf(">=60");case'D':printf("<60");default:printf("error");}}(5.0分)
- 下面程序段的输出结果是______。 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;