Page 1 of 1

linkedStackType myStack; myStack.push(10); myStack.push(20); myStack.pop(); cout<
Posted: Fri Jun 10, 2022 11:57 am
by correctanswer
linkedStackType<int>
myStack;
myStack.push(10);
myStack.push(20);
myStack.pop();
cout<<myStack.top()<<endl;
myStack.push(25);
myStack.push(2*myStack.top());
myStack.push(-10);
myStack.pop();
linkedStackType<int>tempStack;
tempStack=myStack;
while(!tempStack.isEmptyStack())
{
cout<<tempStack.top()<< “
”;
tempStack.pop();
}
cout<<endl;
cout<<myStack.top()<<endl;
Stack s = new Stack();
s.push(7);
s.push(3);
s.push(4);
s.pop();
s.Push (8);
s.pop();
s.pop();
s.Push (2);
s.Push (9);
s.Push (5);
s.pop();
s.pop();