输入三门功课成绩,取三门成绩平均值显示等级。(100-90为优秀,90-80为良,80-70为中,70-60为及格,<60为不及格)
3条回答 默认 最新
Leodong. 2023-04-08 11:18关注#include <iostream> using namespace std; int main() { double score1, score2, score3, avg; cout << "请输入三门功课成绩:"; cin >> score1 >> score2 >> score3; avg = (score1 + score2 + score3) / 3.0; if (avg >= 90) { cout << "等级:优秀" << endl; } else if (avg >= 80) { cout << "等级:良" << endl; } else if (avg >= 70) { cout << "等级:中" << endl; } else if (avg >= 60) { cout << "等级:及格" << endl; } else { cout << "等级:不及格" << endl; } return 0; }
如果以上回答对您有所帮助,点击一下采纳该答案~谢谢
解决 无用评论 打赏 举报