front priority queue cpp

#include <iostream>
#include <queue>

using namespace std;

int main() {
    // Step 1: Declare a priority queue of integers (default is max heap).
    priority_queue<int> pq;

    // Step 2: Insert elements into the priority queue.
    pq.push(30);
    pq.push(10);
    pq.push(50);
    pq.push(20);

    // Step 3: Access the top element (maximum element in max heap).
    int topElement = pq.top();

    // Step 4: Print the top element.
    cout << "Top Element: " << topElement << endl;

    // Step 5: Remove the top element.
    pq.pop();

    // Step 6: Check if the priority queue is empty.
    bool isEmpty = pq.empty();

    // Step 7: Get the size of the priority queue.
    int size = pq.size();

    // Step 8: Print the elements of the priority queue while it's not empty.
    while (!pq.empty()) {
        cout << pq.top() << " ";
        pq.pop();
    }

    // Step 9: Print a newline for formatting.
    cout << endl;

    return 0;
}