int score = 90;
if(score >= 90){
textBox1.Text = "优秀";
}
else if (score >= 80 && score < 90) {
textBox1.Text = "良好";
}else if(score >=70 && score<80){
textBox1.Text = "中等";
}else if (score >=60 && score<70){
textBox1.Text = "及格";
}else{
textBox1.Text = "不及格";
}
switch(score / 10){
case 10:
textBox1.Text = "优秀";break;
case 9:
textBox1.Text = "优秀";break;
case 8:
textBox1.Text = "良好";break;
case 7:
textBox1.Text = "中等";break;
case 6:
textBox1.Text = "及格";break;
default:
textBox1.Text = "不及格";break;
}
C#分支结构选择结构IF、SWITCH判断学生成绩是否及格区间
最新推荐文章于 2024-02-25 21:49:08 发布