Thread: stack project

  1. #16
    Fear the Reaper...
    Join Date
    Aug 2005
    Location
    Toronto, Ontario, Canada
    Posts
    625
    Quote Originally Posted by dwks
    Actually, pushing something onto a stack is "placing it on top". popping something removes it.
    Well, yeah, but it doesn't necessarily mean taking an element not in the stack and placing it on top. You can also "push" elements of a stack to the top. That's why I thought the terminology wasn't quite correct.

    But anyways, winky, you're getting closer to what you're looking for. All the pushes in the code you just put up are unnecessary. You should be popping values off of your stacks.
    Teacher: "You connect with Internet Explorer, but what is your browser? You know, Yahoo, Webcrawler...?" It's great to see the educational system moving in the right direction

  2. #17
    ATH0 quzah's Avatar
    Join Date
    Oct 2001
    Posts
    14,826
    You said:
    Quote Originally Posted by Happy_Reaper
    Ok, you seem to be slowly cathing the concept. The one problem that you have with the code up here is that you're placing (and for the record, "pushing" something in a stack is not placing it on top...) the result back on top of the stack.
    But you're wrong. A 'push' does in fact place something on top of the stack. That's the only method a stack uses to add something. "Inserting" isn't the same as "pushing". Also, if you're using insertion, then you're no longer following the rules that are the very nature of a stack. A stack doesn't have to care where you're pushing something from, what the source of it is. All it cares about is if you push something, it goes on top, and if you pop something, it comes off of the top.

    A queue works the exact same way, except the 'pop' removes the bottom item. The 'push' however, still places it on top.


    Quzah.
    Hope is the first step on the road to disappointment.

  3. #18
    Registered User
    Join Date
    Sep 2005
    Posts
    52
    is there anyone I can pay on here to do the two assignments I have posted for me? I am going to be on thanksgiving break next week and that's when it is due. where I will I be I won't have access to the internet which is what I need to compile and I have no clue how to finish either of these projects.
    Last edited by the_winky_files; 11-13-2005 at 06:26 PM.

  4. #19
    Registered User
    Join Date
    Sep 2001
    Posts
    4,912
    That's an extremely serious offense at every educational institution I've ever heard of. It's also against forum rules.

    Closed.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Fixing my program
    By Mcwaffle in forum C Programming
    Replies: 5
    Last Post: 11-05-2008, 03:55 AM
  2. Need Help with Stack
    By trongsi in forum C++ Programming
    Replies: 9
    Last Post: 05-23-2006, 04:14 PM
  3. Finished Stack
    By the pooper in forum C Programming
    Replies: 11
    Last Post: 02-02-2005, 10:52 AM
  4. Stacks
    By Cmuppet in forum C Programming
    Replies: 19
    Last Post: 10-13-2004, 02:32 PM
  5. What am I doing wrong, stack?
    By TeenyTig in forum C Programming
    Replies: 2
    Last Post: 05-27-2002, 02:12 PM