Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //============================================================= stack.h ======
- //= C++ class for a stack of integers data structure
- //============================================================================
- //= Make: Not Applicable
- //= Exec: Not Applicable
- //=---------------------------------------------------------------------------
- //= Notes: See stack.cpp for member functions
- //=---------------------------------------------------------------------------
- //= History: KJC (09/27/16) - Originate
- //============================================================================
- class stack
- {
- private:
- int *s_array; // Array of intergers for stack
- int size; // Size of stack
- int top; // Pointer to top element in stack
- public:
- stack() {} // Default constructor
- stack(int length); // Constructor allocates memory for s_array
- int get_top(void); // Returns pointer to top (-1, ... size - 1)
- void push(int x); // Pushes x onto stack
- int pop(void); // Pops and returns popped value
- ~stack(void); // Destructor frees memory for s_array
- };
Add Comment
Please, Sign In to add comment