台中女中程式解題系統:b021: 指考分發
題目連結 http://www.tcgs.tc.edu.tw:1218/ShowProblem?problemid=b021 。 此題用struct並改寫 C++語言sort 的比較函數comp即可。 struct Score { int n; int total; int math; }; int cmp(Score s1, Score s2) { if (s1.total == s2.total) { return s1.math > s2.math; } else return s1.total > s2.total; } 程式碼: #include <iostream> #include <vector> #include <algorithm> ...