Advertisement
Guest User

Untitled

a guest
Oct 26th, 2016
62
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.85 KB | None | 0 0
  1. Christian Martinez (890346273)
  2. CPSC 131
  3. Wu
  4. 10/26/16
  5.  
  6. Homework #9
  7.  
  8. 1.)
  9. #include “ExtendableVector.h”
  10. template <typename E>
  11. class ExtendableVectorStack {
  12. public:
  13. ExtendableVectorStack (); // constructor: no need to specify capacity!
  14. int size() {
  15. return (t+1);
  16. } // number of items in the stack
  17. bool empty() {
  18. return (0>t);
  19. } // is the stack empty?
  20. E& top(); // get the top element
  21. void push(E& e); // push element onto stack
  22. void pop(); // pop the stack
  23. private:
  24. enum {
  25. CAPACITY=100
  26. };
  27. E* S;
  28. int capacity;
  29. int t;
  30. // “wrap” the ExtendableVector here along with other variables necessary to implement the public methods
  31. };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement