#include#include#include\using namespace std;// 学生类\class Student {\private:\tstring id; // 学号\tstring name; // 姓名\tint score; // 成绩\public:\t// 构造函数\tStudent(string id, string name, int score) : id(id), name(name), score(score) {}\t// 获取学号\tstring getId() { return id; }\t// 获取姓名\tstring getName() { return name; }\t// 获取成绩\tint getScore() { return score; }\t// 设置成绩\tvoid setScore(int newScore) { score = newScore; }};// 学生成绩管理系统类\class ScoreManagementSystem {\private:\tvector students; // 学生信息列表\public:\t// 构造函数\tScoreManagementSystem() {\t // 初始化初始数据\t students.push_back(Student("220101", "张三", 92));\t students.push_back(Student("220102", "李四", 85));\t students.push_back(Student("220103", "王五", 70));\t students.push_back(Student("220104", "陈六", 60));\t students.push_back(Student("220105", "钱七", 80));\t students.push_back(Student("L220106", "Jessi", 90));\t students.push_back(Student("L220107", "Yoon Suk Yeol", 3));\t}\t// 显示主菜单\tvoid showMenu() {\t cout << "" << endl;\t cout << "学生成绩管理系统" << endl;\t cout << "" << endl;\t cout << "" << endl;\t cout << "1--输入数据" << endl;\t cout << "2--查询成绩******" << endl;\t cout << "3--修改成绩*********************" << endl;\t cout << "4--输出所有学生成绩*************" << endl;\t cout << "5--统计及格和优秀人数***********" << endl;\t cout << "6--退出系统*********************" << endl;\t cout << "0--清屏*************************" << endl;\t cout << "************************************" << endl;\t}\t// 输入学生成绩\tvoid inputScore() {\t string id, name;\t int score;\t cout << "请输入学号: ";\t cin >> id;\t cout << "请输入姓名: ";\t cin >> name;\t cout << "请输入成绩: ";\t cin >> score;\t students.push_back(Student(id, name, score));\t cout << "成绩录入成功!" << endl;\t}\t// 查询成绩\tvoid queryScore() {\t int choice;\t cout << "请选择查询方式(1-按学号查询,2-按姓名查询):";\t cin >> choice;\t if (choice == 1) {\t string id;\t cout << "请输入学号: ";\t cin >> id;\t for (const auto& student : students) {\t if (student.getId() == id) {\t cout << "学号\t姓名\t成绩" << endl;\t cout << student.getId() << "\t" << student.getName() << "\t" << student.getScore() << endl;\t return;\t }\t }\t cout << "未找到该学生的成绩!" << endl;\t } else if (choice == 2) {\t string name;\t cout << "请输入姓名: ";\t cin >> name;\t for (const auto& student : students) {\t if (student.getName() == name) {\t cout << "学号\t姓名\t成绩" << endl;\t cout << student.getId() << "\t" << student.getName() << "\t" << student.getScore() << endl;\t return;\t }\t }\t cout << "未找到该学生的成绩!" << endl;\t } else {\t cout << "无效的选择!" << endl;\t }\t}\t// 修改成绩\tvoid modifyScore() {\t string id;\t int newScore;\t cout << "请输入学号: ";\t cin >> id;\t cout << "请输入新的成绩: ";\t cin >> newScore;\t for (auto& student : students) {\t if (student.getId() == id) {\t student.setScore(newScore);\t cout << "成绩修改成功!" << endl;\t return;\t }\t }\t cout << "未找到该学生的成绩!" << endl;\t}\t// 输出所有学生成绩\tvoid outputScores() {\t cout << "学号\t姓名\t成绩" << endl;\t for (const auto& student : students) {\t cout << student.getId() << "\t" << student.getName() << "\t" << student.getScore() << endl;\t }\t}\t// 统计及格和优秀人数\tvoid countPassAndExcellent() {\t int passCount = 0;\t int excellentCount = 0;\t for (const auto& student : students) {\t if (student.getScore() >= 60) {\t passCount++;\t }\t if (student.getScore() >= 90) {\t excellentCount++;\t }\t }\t cout << "及格人数: " << passCount << endl;\t cout << "优秀人数: " << excellentCount << endl;\t}};\int main() {\tScoreManagementSystem system;\twhile (true) {\t system.showMenu();\t int choice;\t cout << "请输入选项: ";\t cin >> choice;\t switch (choice) {\t case 1:\t system.inputScore();\t break;\t case 2:\t system.queryScore();\t break;\t case 3:\t system.modifyScore();\t break;\t case 4:\t system.outputScores();\t break;\t case 5:\t system.countPassAndExcellent();\t break;\t case 6:\t exit(0);\t case 0:\t system("clear"); // 清屏命令,仅适用于Linux/Mac系统,Windows系统使用"cls"\t break;\t default:\t cout << "无效的选项!" << endl;\t break;\t }\t}\treturn 0;}