User Profile
Collapse
-
thanks everyone, I figured it out before the previous post, but that just confirms it. It seems like a stupid question now that I figured it out, so thanks everyone for your help. -
Thats kind of what I thought, but the homework question reads: part a
"Write a function
Code:template <typename T> T second(const stack<T>& s);
For this part I just popped to T temp then used top( ) then push(temp) and I output the value that I got from top( )
But for part b:
...Leave a comment:
-
Accessing elements in a stack?
I need to be able to access and move elements within a stack (C++ STL). I have tried using an iterator to navigate to the element that I want to move, but then I realized that I don't know how to remove that element. Is there a way to use pop to remove the element that my iterator is pointing to? Can you even use iterators on a stack? I'm kind of lost. Any help would be greatly appreciated.
No activity results to display
Show More
Leave a comment: