As we know priority queue is known for its first element is always the greatest of the elements it contains but how can I make the first element to be the lowest element of them all?
// 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;
system("PAUSE");
return 0;
}
like this one,I want to make 25 to be the first one to be pop out and its gonna be the one on the top element