forked from CSUF-CPSC-131-Fall2019/Data-Structures-Code
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathQueueArray_main.cpp
More file actions
40 lines (29 loc) · 988 Bytes
/
QueueArray_main.cpp
File metadata and controls
40 lines (29 loc) · 988 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
#include <iostream>
#include <stdexcept>
#include "QueueArray.hpp"
using std::cout;
using std::endl;
int main() {
QueueArray<int> myQueue(10); // Array-based queue with capacity 10
cout << "Pushing 10 ..." << endl;
myQueue.push(10);
cout << "Front of queue: " << myQueue.peek() << endl;
cout << "Pushing 20 ..." << endl;
myQueue.push(20);
cout << "Front of queue: " << myQueue.peek() << endl;
cout << "Pushing 30 ..." << endl;
myQueue.push(30);
cout << "Front of queue: " << myQueue.peek() << endl;
cout << "Popping ..." << endl;
myQueue.pop();
cout << "Front of queue: " << myQueue.peek() << endl;
cout << "Popping ..." << endl;
myQueue.pop();
cout << "Front of queue: " << myQueue.peek() << endl;
cout << "Popping ..." << endl;
myQueue.pop();
if (myQueue.empty())
cout << "queue is empty" << endl;
else
cout << "queue is not empty" << endl;
}