stack c++

#include <iostream>
#include <stack>

int main() {
    std::stack<int> myStack;

    // Step 1: Push elements onto the stack
    myStack.push(10);
    myStack.push(20);
    myStack.push(30);

    // Step 2: Check if the stack is empty
    if (myStack.empty()) {
        std::cout << "Stack is empty." << std::endl;
    } else {
        std::cout << "Stack is not empty." << std::endl;
    }

    // Step 3: Access the top element of the stack
    std::cout << "Top element: " << myStack.top() << std::endl;

    // Step 4: Pop elements from the stack
    myStack.pop();

    // Step 5: Check the size of the stack
    std::cout << "Stack size: " << myStack.size() << std::endl;

    return 0;
}