1// C++ program to show that priority_queue is by
2// default a Max Heap
3#include <bits/stdc++.h>
4using namespace std;
5
6// Driver code
7int main ()
8{
9 // Creates a max heap
10 priority_queue <int> pq;
11 pq.push(5);
12 pq.push(1);
13 pq.push(10);
14 pq.push(30);
15 pq.push(20);
16
17 // One by one extract items from max heap
18 while (pq.empty() == false)
19 {
20 cout << pq.top() << " ";
21 pq.pop();
22 }
23
24 return 0;
25}
26