C++ 编程实现班级成绩统计和排名:高效排序算法应用
"#include "iostream"\n#include "vector"\n#include "algorithm"\n\nusing namespace std;\n\nstruct Student {\n int id;\n int chinese;\n int math;\n int english;\n int total;\n int rank;\n\n Student(int id, int chinese, int math, int english) {\n this->id = id;\n this->chinese = chinese;\n this->math = math;\n this->english = english;\n this->total = chinese + math + english;\n this->rank = 1;\n }\n};\n\nbool compare(Student& s1, Student& s2) {\n if (s1.total == s2.total) {\n return s1.id < s2.id;\n }\n return s1.total > s2.total;\n}\n\nint main() {\n int N;\n cin >> N;\n\n vector
原文地址: https://www.cveoy.top/t/topic/p5ob 著作权归作者所有。请勿转载和采集!