You are viewing a single comment's thread. Return to all comments →
struct Player { string name; int score; }; bool comp(Player p1, Player p2){ if(p1.score>p2.score) return true; if(p1.score==p2.score) return p1.name<p2.name; return false; } vector<Player> comparator(vector<Player> players) { sort(players.begin(),players.end(), comp); return players; }
Seems like cookies are disabled on this browser, please enable them to open this website
Sorting: Comparator
You are viewing a single comment's thread. Return to all comments →