现在的位置: 首页 > 综合 > 正文

priority_queue

2013年01月21日 ⁄ 综合 ⁄ 共 272字 ⁄ 字号 评论关闭
// priority_queue::push/pop
#include <iostream>
#include
<queue>
using namespace std;

int main ()
{
priority_queue
<int> mypq;

mypq.push(
30);
mypq.push(
100);
mypq.push(
25);
mypq.push(
40);

cout
<< "Popping out elements...";
while (!mypq.empty())
{
cout
<< " " << mypq.top();
mypq.pop();
}
cout
<< endl;

return 0;
}

抱歉!评论已关闭.