main.cpp 547 B

123456789101112131415161718192021222324252627282930
  1. #include <iostream>
  2. #include "Stack.h"
  3. using namespace std;
  4. int main()
  5. {
  6. Stack<int> stackInt = Stack<int>();
  7. // Store several numbers to the stack
  8. stackInt.Push(32);
  9. stackInt.Push(47);
  10. stackInt.Push(18);
  11. stackInt.Push(59);
  12. stackInt.Push(88);
  13. stackInt.Push(91);
  14. // list the element of stack
  15. while(!stackInt.IsEmpty())
  16. {
  17. // Get the top element
  18. cout << stackInt.Top() << " - ";
  19. // Remove the top element
  20. stackInt.Pop();
  21. }
  22. cout << "END" << endl;
  23. return 0;
  24. }