-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.cpp
More file actions
68 lines (59 loc) · 1.81 KB
/
main.cpp
File metadata and controls
68 lines (59 loc) · 1.81 KB
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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
#include <iostream>
#include "QueueArray.h"
#include "QueueLinked.h"
#include "StackArray.h"
#include "StackLinkedList.h"
using namespace std;
void displayMenu() {
cout << "===============================\n";
cout << "| STACK AND QUEUE MENU |\n";
cout << "===============================\n";
cout << "| 1 | Stack Using Array |\n";
cout << "| 2 | Queue Using Array |\n";
cout << "| 3 | Stack Using Linked List |\n";
cout << "| 4 | Queue Using Linked List |\n";
cout << "| 5 | Exit |\n";
cout << "===============================\n";
cout << "Enter your choice: ";
}
int main() {
int choice;
int size;
cout << "===============================\n";
cout << "| ENTER SIZE |\n";
cout << "===============================\n";
cout << "Size: ";
cin >> size;
StackArray<int> stack(size);
QueueArray<int> queue(size);
StackLinkedList<int> stackLink;
QueueLinkedList<int> queueLink;
do {
displayMenu();
cin >> choice;
switch (choice) {
case 1:
stack.stackArrayMenu();
break;
case 2:
queue.queueArrayMenu();
break;
case 3:
stackLink.stackLinkedListMenue();
break;
case 4:
queueLink.QueueLinkedListMenu();
break;
case 5:
cout << "===============================\n";
cout << "| EXITING PROGRAM |\n";
cout << "===============================\n";
break;
default:
cout << "===============================\n";
cout << "| INVALID OPTION. TRY AGAIN|\n";
cout << "===============================\n";
}
} while (choice != 5);
return 0;
}