-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathqueueADT.cpp
More file actions
54 lines (40 loc) · 1012 Bytes
/
queueADT.cpp
File metadata and controls
54 lines (40 loc) · 1012 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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
#include<bits/stdc++.h>
using namespace std;
#define deb(x) cout << #x << " " << x << endl;
#define deb(x,y) cout << #x << " " << x << endl << #y << " " << y << endl;
class Queue{
// error squiggles
private:
int size = 50;
int f = -1,r = -1;
int arr[50];
public:
void enqueue(int num){
(f++)%(size-1);
arr[f] = num;
}
int dequeue(){
if(r == f) cout << "Queue is empty ";
else{
(r++)%(size-1);
int temp = arr[r];
return temp;
}
}
int front(){
if(f != r) return arr[f];
}
int rare(){
if(f != r) return arr[r];
}
bool isEmpty(){
if(f != r) return false;
else return true;
}
};
int main(){
Queue *q = new Queue();
for(int i = 0; i < 10; i++) q->enqueue(i);
n it a =
// for(int i = 0; i < 10; i++) deb(q->dequeue();
}