Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /**
- * [abq.cpp]
- * Array-based queue example.
- *
- * compile with:
- * g++ -m32 -static-libgcc -o abq abq.cpp ArrayBasedQueue.cpp
- */
- #include "ArrayBasedQueue.h"
- int main(void)
- {
- /**
- * Array-Based Queue OBJECT CREATION:
- */
- ArrayBasedQueue *abq = new ArrayBasedQueue(2);
- /**
- * Array-Based Queue STATUS CHECK:
- */
- std::cout << "Is Empty? " << ((abq->IsEmpty()) ? "yes" : "no") << std::endl << std::endl;
- /**
- * Array-Based Queue ITEM ENQUEUE:
- */
- while(!abq->IsFull())
- abq->Enqueue(2);
- /**
- * Array-Based Queue STATUS CHECK:
- */
- std::cout << "Is Empty? " << ((abq->IsEmpty()) ? "yes" : "no") << std::endl;
- std::cout << "Is Full? " << ((abq->IsFull()) ? "yes" : "no") << std::endl << std::endl;
- /**
- * Array-Based Queue ITEM DEQUEUE:
- */
- float item;
- abq->Dequeue(item);
- /**
- * Array-Based Queue ITEM ENQUEUE:
- */
- if(!abq->IsFull())
- abq->Enqueue(4);
- /**
- * Array-Based Queue ITEM DEQUEUE/OUTPUT:
- */
- while(!abq->IsEmpty())
- {
- abq->Dequeue(item);
- std::cout << item << std::endl;
- }
- /**
- * Array-Based Queue OBJECT DELETION:
- */
- delete abq;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement