Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /**
- * [ABStack.cpp]
- * Array-based stack example.
- *
- * compile with:
- * g++ -m32 -static-libgcc -o abstack ABStack.cpp ArrayBasedStack.cpp
- */
- #include "ArrayBasedStack.h"
- int main(void)
- {
- /**
- * Array-Based Stack OBJECT CREATION:
- */
- ArrayBasedStack *ABStack = new ArrayBasedStack(); // a stack created on the heap :|
- /**
- * Array-Based Stack ITEM ADDITION:
- */
- if(!ABStack->IsFull()) ABStack->Push(2.4);
- if(!ABStack->IsFull()) ABStack->Push(1.3);
- /**
- * Array-Based Stack ITEM RETRIEVAL:
- */
- float newItem;
- while(!ABStack->IsEmpty())
- {
- ABStack->Pop(newItem);
- std::cout << newItem << std::endl;
- }
- /**
- * Array-Based Stack OBJECT DELETION:
- */
- delete ABStack;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement