How?

how can i get the top and the second item of a stack?
for example i have 12,34,6 and i want the first two 12,34 and print them.

Last edited on
That depends on how your stack was implemented.

With a std::stack the only element you can see is the top element. To see the next element you'll first need to pop the first element off the stack.



Topic archived. No new replies allowed.