格式
    bool operator < (const node &temp)const{return ...;}

    1. //应用样例
    2. #include<bits/stdc++.h>
    3. using namespace std;
    4. struct node{
    5. int a,b;
    6. bool operator < (const node &c)const{
    7. if(a==c.a) return b<c.b;
    8. else return a>c.a;
    9. }
    10. }t[10];
    11. int main(){
    12. t[0]={4,1},t[1]={6,2},t[2]={5,3},t[3]={7,4},t[4]={5,5};
    13. sort(t,t+5);
    14. for(int i=0;i<5;i++) cout<<t[i].a<<" "<<t[i].b<<endl;
    15. return 0;
    16. }
    17. /*
    18. 输出:
    19. 7 4
    20. 6 2
    21. 5 3
    22. 5 5
    23. 4 1
    24. */