标签:opera tor main include public const cti space begin
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
class Action
{
public:
int room;
int time;
int type;
Action(int room_, int time_, int type_)
{
room = room_;
time = time_;
type = type_;
};
show()
{
cout<<"the message is "<<room<<" "<<time<<" "<<type<<endl;
return 0;
};
bool operator< (const Action &other) const {
if(time<other.time) return true;
else if(time==other.time && type<other.type) return true;
else if(time==other.time && type==other.type && room<other.room) return true;
return false;
}
};
int main()
{
Action t1(1,22,3);
Action t2(1,4,3);
vector<Action> action;
action.push_back(t1);
action.push_back(t2);
sort(action.begin(), action.end());
// for (int i =0 ; i< action.size(); i++)
// action[i].show();
return 0;
}
标签:opera tor main include public const cti space begin
原文地址:https://www.cnblogs.com/yeran/p/10542889.html