← Back to STL Containers
Question 503
Pop Then Peek
Pop Then Peek
Astack<int>namedsalready holds 1, 2, 3 (3 is on top). Remove the top element withpop(), then print the new top element and the number of elements left, each on its own line. Print exactly what is shown in Expected Output.
Expected Output:
Top: 2 Size: 2
= newline. The output ends with a newline — print one after the last line.
Hints3 available
Sign in to use hintsTopics:
STL ContainersStacks
1
Tab to indent (Esc then Tab to move on) · Ctrl+Enter to run · Shift+Alt+F to format · Ctrl+Space to expand shortcuts (cout, fori)
Your Output
Run your code to see the output here...
Test Cases
Run your code to see test case results.