Advertisement
Loesome

Stack.h

Apr 6th, 2014
363
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.68 KB | None | 0 0
  1. #ifndef STACKADT_H
  2. #define STACKADT_H
  3. #include <Stack.h>
  4. #include <iostream>
  5. using namespace std;
  6.  
  7. template <typename E>
  8. class StackADT {
  9. private:
  10. void operator =(const StackADT&) {}
  11. StackADT(const StackADT&) {}
  12. E P[100];
  13. int top = 0;
  14.  
  15.  
  16. public:
  17. StackADT() {}
  18. ~StackADT() {}
  19.  
  20. void clear(){
  21. top = 0;
  22. }
  23. void push(const E& it){
  24. P[top] = it;
  25. top++;
  26. }
  27. E pop(){
  28. E top = P[this->top - 1];
  29. this->top--;
  30. cout << "Pop de: " << top << endl;
  31. }
  32. const E& topValue(){
  33. return P[top - 1];
  34. }
  35. int length(){
  36. return top;
  37. }
  38. };
  39.  
  40.  
  41. #endif // STACKADT_H
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement