Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include "StackADT.h"
- #include <iostream>
- using namespace std;
- int main()
- {
- StackADT<int> * stack = new StackADT<int>();
- for(int i = 1;i < 10;i++){
- stack->push(i);
- }
- cout << "Top: " << stack->topValue() << endl;
- cout << "Size: " << stack->length() << endl;
- while(1){
- stack->pop();
- if(stack->length() == 0){
- break;
- }
- }
- stack->clear();
- for(int i = 10;i < 21;i++){
- stack->push(i);
- }
- cout << "Top: " << stack->topValue() << endl;
- cout << "Size: " << stack->length() << endl;
- while(1){
- stack->pop();
- if(stack->length() == 0){
- break;
- }
- }
- cout << "Size: " << stack->length() << endl;
- stack->~StackADT();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement