Queue in cpp

#include <iostream>
#include <queue>

int main() {
    // Step 1: Declare a queue
    std::queue<int> myQueue;

    // Step 2: Insert elements into the queue using push()
    myQueue.push(10);
    myQueue.push(20);
    myQueue.push(30);

    // Step 3: Access the front element using front()
    std::cout << "Front element: " << myQueue.front() << std::endl;

    // Step 4: Access the back element using back()
    std::cout << "Back element: " << myQueue.back() << std::endl;

    // Step 5: Check if the queue is empty using empty()
    std::cout << "Is the queue empty? " << (myQueue.empty() ? "Yes" : "No") << std::endl;

    // Step 6: Get the size of the queue using size()
    std::cout << "Size of the queue: " << myQueue.size() << std::endl;

    // Step 7: Remove the front element using pop()
    myQueue.pop();

    // Step 8: Display the elements in the queue
    std::cout << "Elements in the queue: ";
    while (!myQueue.empty()) {
        std::cout << myQueue.front() << " ";
        myQueue.pop();
    }

    return 0;
}