User Profile

Collapse

Profile Sidebar

Collapse
scuba6388
scuba6388
Last Activity: Apr 3 '08, 03:43 PM
Joined: Mar 31 '08
Location:
  •  
  • Time
  • Show
  • Source
Clear All
new posts

  • scuba6388
    replied to Accessing elements in a stack?
    in C
    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.
    See more | Go to post

    Leave a comment:


  • scuba6388
    replied to Accessing elements in a stack?
    in C
    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);
    that uses stack operations to return the second element on the stack."

    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:

    ...
    See more | Go to post

    Leave a comment:


  • scuba6388
    started a topic Accessing elements in a stack?
    in C

    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.
    See more | Go to post
No activity results to display
Show More
Working...