Click to See Complete Forum and Search --> : Stack Class Query


jpmcfly
March 4th, 2009, 08:24 AM
I have an examination coming up in three weeks time and having been looking through some past examination papers I have encountered a question in the previous 4 years which I am unable to answer mainly because I dont grasp what it is looking for me to do. I understand the concept of a stack as a LIFO data structures and the operations associated with it ie push / pop.

I would be very grateful if you could give me some pointers as to how I could go about answering this question as I am sure that it is something that I will encounter on my exam.

QUESTION:
--------------
An operation that displays the contents of a stack can be useful during program debugging. Write a display function such that

a. The function uses ADT stack operations; that is, it is independent of the stack’s implementation

b. The function assumes and uses the pointer-based implementation of the ADT stack

jpmcfly
March 5th, 2009, 01:21 PM
Can someone please give some help as to what this question is asking me to do

laserlight
March 5th, 2009, 01:35 PM
I think that all it is asking you to do is to write a function that prints the contents of a stack. In the first case, you are supposed to use a generic stack interface (e.g., you write a function template with std::stack in C++) instead of relying on an implementation, while in the second case, you are supposed to implement a stack yourself using pointers and have your display function use that.

jpmcfly
March 5th, 2009, 08:42 PM
thank you for your help my friend it is greatly appreciated