• 2021-04-14
    #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”); } } 运行结果为( )
  • 70-80 60-70

    内容

    • 0

      若a,b均是整型变量,正确的switch语句是( )。 A: switch(a){case 1.0: printf(“i\n”);case 2: printf(“you\n”); ”);} B: switch(a){case b: printf(“i\n”);case 1: printf(“you\n”);} C: switch(a+b){case 1: printf(“i\n”);case 2*a: printf(“you\n”);} D: switch(a+b){case 1: printf(“i\n”);case 2: printf(“you\n”);}

    • 1

      若输入B,以下程序的运行结果为。 main() {char grade;scanf("%c",&grade); switch(grade) {case'A':printf(">=85."); case'B': case'C':printf(">=60."); case'D':printf("<60."); default:printf("error."); } }

    • 2

      若有以下定义,则正确的switch语句是______。float x;int a,b; A: switch(x) B: case 1.0:printf("*\n"); C: csse 2.0:printf("**\n"); D: switch(x) E: case 1,2:printf("*\n"); F: case 3:printf("**\n"); G: switch(a+b) H: case 1:printf("\n"); I: case 1+2:printf("**\n"); J: switch(a+b); K: case 1:printf("*\n"); L: case 2:printf("**\n");

    • 3

      若有float x; int a,b; ,下面四条switch语句中正确的有( )条。 switch(x) { case x=1.0: printf(“Y”); case x=2.0: printf(“N”); } switch(a) { case a=1: printf(“Y”); case a=2: printf(“N”); } switch(b) { case b==1: printf(“Y”); case b==2: printf(“N”); } switch(x) { case 1.0: printf(“Y”); case 2.0: printf(“N”); }

    • 4

      智慧职教:将下列程序补充完整,实现成绩等级输出。#include voidmain(){ int score;   printf("请输入课程成绩(整数):");   scanf("%d",_____________);   if(score>100||score<0) printf("输入错误!\n");   ___________           switch((int)_____________)           { case10:               case 9: printf("优秀!\n");_______________;               case 8: printf("良好!\n");break;               case 7: printf("中等!\n");break;               case 6: printf("及格!\n");break;               ___________: printf("不及格!\n");           }}5a0d99e305fecac500efc6ceb6743312198ebb4c0b8ac8d45ef1b9c6a80adc39a7be2ada98413e6c26c75ec4895239a23c5293ff6edff209abd64c9363088bbdf81f9a20a32b1b046de18a8f04c74749