sort

it2022-05-05  58

struct node { char str[22]; int num; int score; }stu[N]; bool cmp(const node &a, const node &b) { if(a.score == b.score) return strcmp(a.str, b.str) < 0 ? 1 : 0; //按字典序升序 else return a.score > b.score; } sort(stu , stu + N, cmp);

 

转载于:https://www.cnblogs.com/wwjyt/p/3178672.html


最新回复(0)