优先队列——成绩从高到低排列,相同者按语文成绩排列

//
//  main.cpp
//  160929
//
//  Created by liuzhe on 16/9/29.
//  Copyright © 2016年 my_code. All rights reserved.
//
//#include 

#include 
#include 
#include 
#include 
#include 
#include 
#include 
#include 
#include 
#include 
#include 
#include 
using namespace std;

//成绩从高到低排列,相同者按语文成绩排列
class student{
    int no;
    string name;
    int chinese;
    int math;
public:
    student(){}
    student(int no,string name,int chinese,int math){
        this->no = no;
        this->name = name;
        this->chinese = chinese;
        this->math = math;
    }
    int getno()const{
        return no;
    }
    string getname()const{
        return name;
    }
    int getchinese()const{
        return chinese;
    }
    int getmath()const{
        return math;
    }
    bool operator < (const student& s)const{
        int sum1 = chinese+math;
        int chinese2 = s.getchinese();
        int math2 = s.getmath();
        int sum2 = chinese2+math2;
        if(sum1pr(s,s+4);
    while(!pr.empty()){
        const student& t = pr.top();
        cout<


你可能感兴趣的:(==数据结构==,STL)