fork download
  1. #include <iostream>
  2. #include <queue>
  3. using namespace std;
  4.  
  5. int main() {
  6. priority_queue<int> pq;
  7.  
  8. // Pushing elements
  9. pq.push(40);
  10. pq.push(10);
  11. pq.push(30);
  12. pq.push(20);
  13.  
  14. while (!pq.empty()) {
  15. cout << pq.top() <<endl;
  16. pq.pop();
  17. }
  18. return 0;
  19. }
Success #stdin #stdout 0.01s 5288KB
stdin
Standard input is empty
stdout
40
30
20
10