-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.cpp
118 lines (108 loc) · 2 KB
/
main.cpp
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
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
#include<iostream>
//#include"CircularQueue.h"
//#include"Stack.h"
//#include "LinkedQueue.h"
//#include "DoublyLinkedlist/DoublyLinkedlist.h"
using namespace std;
int n;
bool ok(int k) {
cin >> n;
for (int i = 1; i <= k; ++i) {
if (i == n)return true;
}
return false;
}
int main() {
//#define _cq
#ifdef _cq
string introCQ = R"(
===============
1-> EnQ
2-> DeQ
3-> display
4-> isFull
5-> isEmpty
6-> clear
===============
)";
CQ cq{};
cout << introCQ;
int q;
while (ok(6)) {
if (n == 1)
cin >> q, enqueue(q, &cq);
else if (n == 2)
dequeue(&cq);
else if (n == 3)
display(&cq);
else if (n == 4)
cout << (isFull(&cq) ? "Q is full" : "Q not full");
else if (n == 5)
cout << (isEmpty(&cq) ? "Q is empty" : "Q not empty");
else if (n == 6)
clear(&cq);
cout << introCQ;
}
#endif //_cq
//#define _st
#ifdef _st
string introSt = R"(
===============
1-> push
2-> pop
3-> display
4-> search
5-> count
6-> Top
===============
)";
cout << introSt;
int q;
while (ok(6)) {
if (n == 1)
cin >> q, push(q);
else if (n == 2)
pop();
else if (n == 3)
display();
else if (n == 4)
cin >> q, search(q);
else if (n == 5)
count();
else if (n == 6)
Top();
cout << introSt;
}
#endif //_st
//#define _Q
#ifdef _Q
string introQ = R"(
===============
1-> enQ
2-> deQ
3-> display
4-> search
5-> count
6-> Top
===============
)";
cout << introQ;
int q;
while (ok(5)) {
if (n == 1)
cin >> q, enQ(q);
else if (n == 2)
deQ();
else if (n == 3)
displayQ();
// else if (n == 4)
// cin >> q, search(q);
else if (n == 5)
countQ();
// else if (n == 6)
// Top();
cout << introQ;
}
#endif //_Q
return 0;
}