main.cpp 861 B

1234567891011121314151617181920212223242526272829303132
  1. #include "queue.h"
  2. int main() {
  3. int count;
  4. int item;
  5. queue myQueue;
  6. cout << "--------------------------------------------------------\n\n";
  7. cout << " Programming a Queue in C++\n\n";
  8. cout << "--------------------------------------------------------\n\n";
  9. cout << "This program simulates a waiting line -- also called a\n";
  10. cout << "queue -- using a queue data structure.\n\n";
  11. cout << "This program only handles integers at the moment.\n";
  12. cout << "";
  13. for (count = 0; count < SIZE; ++count) {
  14. cout << "Entry " << count + 1 << ": ";
  15. cin >> item;
  16. myQueue.enqueue(item);
  17. cout << "Items in the list: " << myQueue.size() << endl;
  18. }
  19. cout << "\nNow to dequeue those items:\n" << endl;
  20. for (count = 0; count < SIZE; ++count) {
  21. cout << "Entry " << count + 1 << ": " << myQueue.dequeue() << endl;
  22. }
  23. return (0);
  24. }