#include<iostream>

#include<stack>

using namespace std;

int main()
{
stack mystack;
mystack.push(10);
mystack.push(20);
mystack.push(30);
mystack.push(40);
mystack.push(50);
mystack.push(60);
mystack.push(70);

// Stack becomes 10,20,30,40,50,60,70

mystack.pop();
mystack.pop();
mystack.pop();

// Stack becomes 1, 2,3

while (!mystack.empty()) {
    cout << ' ' << mystack.top();
    mystack.pop();
}

}

By RRR

Leave a Reply

Your email address will not be published.