91学习

陪伴你每一天!

switch()在C语言中多选择

#include <stdio.h>

int main(){

char cGrade;

printf("please enter your grade\n");

scanf("%c",&cGrade);

printf("Grade is about:");

switch(cGrade){

case 'A':

printf("90~100\n");

break;

case 'B':

printf("80~89\n");

break;

case 'C':

printf("70~79\n");

break;

case 'D':

printf("60~69\n");

break;

case 'F':

printf("<60\n");

break;

default:

printf("you enter the char is wrong!\n");

break;

}

return 0;

}

POSji18790284560.png

发表评论:

◎欢迎参与讨论,请在这里发表您的看法、交流您的观点。