c 2b 2b accessing in priority queue

Solutions on MaxInterview for c 2b 2b accessing in priority queue by the best coders in the world

showing results for - "c 2b 2b accessing in priority queue"
Annaelle
16 Nov 2018
1/* Program to access an element of highest priority */
2 
3#include<iostream>
4#include<queue>     //Header-file for queue
5using namespace std;
6 
7 
8int main()
9{
10priority_queue<int> p1;
11p1.push(35);    
12p1.push(40);
13p1.push(95);
14p1.push(25);
15  
16cout<<p1.top();      //fetch element of highest
17priority(maximum element) i.e 95
18}
19