Lab #5

 

CSC 2200 

Fall 2002



Up

Lab preparation (at home)

Goal

Implement the Stack ADT using the Doubly Linked List ADT implemented in Lab #4. Your stack implementation should support the following member functions:

bulletpush( ): Push a value on the stack
bulletpop( ): Pop a value from the stack
bullettopValue( ): Return the value at the top of the stack
bulletlength( ): Return the number of elements in the stack
bulletprint( ): Print stack contents

Also, provide appropriate constructor and destructor. You implementation can use only the member functions of the list ADT implemented in lab #4.

class Stack {
    public:
        Stack();
        ~Stack();
        bool push(int i);
        bool pop(int &i);
        bool top(int &i);
        int length() const;
        void print() const;       
};


Lab report

Finish the implementation and test it.


For problems or questions regarding this web contact besta@cs.wayne.edu.
Last updated: September 09, 2002.