containers/priority-queue/pri-queue-1.cpp - Illustration of priority_queue<Point, deque<Point> >. | Lecture 6 - slide 11 : 40 Program 1 |
#include <iostream> #include <string> #include <queue> #include <list> #include "point.h" int main(){ using namespace std; priority_queue<Point, deque<Point> > point_queue; // A priority queue of points. // Built on a deque<Point>. Point p1(1,2), p2(-5,27), p3(3,4), p4(7,8), p5(-3,-4), p6(0,0); point_queue.push(p1); point_queue.push(p2); point_queue.push(p3); point_queue.push(p4); point_queue.push(p5); point_queue.push(p6); while (not (point_queue.empty())){ cout << point_queue.top() << " "; // (-5,27) (7,8) (3,4) (1,2) (0,0) (-3,-4) point_queue.pop(); } }