• Hey, guest user. Hope you're enjoying NeoGAF! Have you considered registering for an account? Come join us and add your take to the daily discourse.

Help with C++..

Status
Not open for further replies.
I currently have this assignment in my C++ programming class. It deals with showing what the runtime stack has in it at the end of the program. So the main function of the program doesn't matter much, it just needs to have something happening in it so the stack can show something at the end(and no, can't use a whole lot of cout statements at the end either, someone already asked :lol ). I'm supposed to use a linked list with nodes and pointer variables and such. I've never used any of these before (pretty much a beginner here), so I'm kinda confused as of right now.

Could anyone throw some tips or help my way, if possible?
 

darscot

Member
When I first dealt with a link list I found it much easier if you visualize a bunch of objects tied together in a line. When moving, deleting or adding objects always consider that you have to cut the strings but at no time do you want an object to fall. So basically dont cut a string untill you have at elast one other string on the object.

String = Pointer.
 

Pochacco

asking dangerous questions
You need to create a structure or class that represents a Node object. This structure/class will have at least one member variable, of type Node object, that points to the next Node in the list. This is easy. If you're lazy, you can just google for it.

Here's some sites that have it all defined - try doing it first, then look at it.
http://www.cee.hw.ac.uk/~rjp/Coursewww/CPPwww/linklist.html
http://www.cs.uregina.ca/Links/class-info/170/LinkedLists/Llist.html

To check out the stuff inside the stack, I'd recommend using a debugger.
You can also do some stack trace stuff, but a debugger is probably the easiet way to go.
 
Status
Not open for further replies.
Top Bottom