首页 > 其他 > 详细

CCCC训练赛一些模板 struct sstream

时间:2018-03-25 13:31:22      阅读:177      评论:0      收藏:0      [点我收藏+]

重载与构造

struct node
{
friend bool operator< (node n1, node n2)
{
return n1.priority > n2.priority;//"<"为从大到小排列,">"为从小到大排列
}

int priority;
int value;
node(int priority, int value) : priority(priority), value(value) {};

};

priority_queue<node>;

//priority_queue<int, vector<int>,less<int> > qi2;//从小到大的优先级队列,可将greater改为less,即为从大到小

读入一行

 

#include<string>
using namespace std;

int main() {

string line;
while (getline(cin, line))
{
stringstream ss(line);
int x;
while(ss >> x)
cout << x;
}

 

CCCC训练赛一些模板 struct sstream

原文:https://www.cnblogs.com/SuuT/p/8644035.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!