Advertisement
Loesome

Untitled

Apr 8th, 2014
362
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.77 KB | None | 0 0
  1. #include "StackADT.h"
  2. #include <iostream>
  3. using namespace std;
  4. int main()
  5. {
  6. StackADT<int> * stack = new StackADT<int>();
  7.  
  8.  
  9. for(int i = 1;i < 10;i++){
  10. stack->push(i);
  11. }
  12. cout << "Top: " << stack->topValue() << endl;
  13. cout << "Size: " << stack->length() << endl;
  14. while(1){
  15. stack->pop();
  16. if(stack->length() == 0){
  17. break;
  18. }
  19. }
  20. stack->clear();
  21. for(int i = 10;i < 21;i++){
  22. stack->push(i);
  23. }
  24. cout << "Top: " << stack->topValue() << endl;
  25. cout << "Size: " << stack->length() << endl;
  26.  
  27. while(1){
  28. stack->pop();
  29. if(stack->length() == 0){
  30. break;
  31. }
  32. }
  33.  
  34. cout << "Size: " << stack->length() << endl;
  35.  
  36. stack->~StackADT();
  37. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement