#include#include int main() { std::priority_queue pq; pq.push(30); pq.push(10); pq.push(50); std::cout << "Max element: " << pq.top(); return 0; }
Max element: 50In this example, we create a priority_queue of integer elements and push 30, 10, and 50 into it. Then, we call top() to retrieve the maximum value, which is 50. The priority_queue container adapter is part of the standard C++ library, so it is included in the `