Discuss teh below:
Q: What is the output from the following sequence of stack operations?
stack intStack;
int x, y = 3;
intStack.push(8);
intStack.push(9);
intStack.push(y);
x = intStack.top();
intStack.pop();
intStack.push(18);
x = intStack.top();
intStack.pop();
intStackpush(22);
while (!intStack.empty())
{ y = intStack.top();
intStack.pop();
cout << y << " ";
}
cout << x << endl;