Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Christian Martinez (890346273)
- CPSC 131
- Wu
- 10/26/16
- Homework #9
- 1.)
- #include “ExtendableVector.h”
- template <typename E>
- class ExtendableVectorStack {
- public:
- ExtendableVectorStack (); // constructor: no need to specify capacity!
- int size() {
- return (t+1);
- } // number of items in the stack
- bool empty() {
- return (0>t);
- } // is the stack empty?
- E& top(); // get the top element
- void push(E& e); // push element onto stack
- void pop(); // pop the stack
- private:
- enum {
- CAPACITY=100
- };
- E* S;
- int capacity;
- int t;
- // “wrap” the ExtendableVector here along with other variables necessary to implement the public methods
- };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement