一、最主要的输出点
#include<stdio.h>
void main() {
int score;
scanf("%d", &score);
if (score < 0 || score>100)
printf("The score not betwenn 0 and 100!\n");
else {
switch (score / 10) {
case 10:
case 9:printf("A\n"); break;
case 8:printf("B\n");
case 7:printf("C\n"); break;
case 6:printf("D\n"); break;
default:printf("E\n"); break;
}
}
}
输出一个数,在无break的区间内,输出的结果是到下一个break之间的结果。
二、switch语句
switch(表达式)//表达式只能为int 型(整型)、char型(字符型)
case 常量表达式 : 语句1 ; break ;
个人理解,如有错误请多多指教