why does this for loop doesn’t work on stack :- for(auto s:stack)
to print the content of stack
and is there any another method to print the content of stack
How to print the content of stack
Because Stack does not have iterators , by definition of stack …
To print the content of the stack, you would have to pop out the elements one by one…