-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathqueue.h
More file actions
52 lines (43 loc) · 679 Bytes
/
Copy pathqueue.h
File metadata and controls
52 lines (43 loc) · 679 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
#ifndef QUEUE
#define QUEUE
class Customer {
private:
int arrive;
int ptime;
public:
Customer() {
arrive = 0;
ptime = 0;
}
void set(int arrive);
int get_arrive() {
return arrive;
}
int get_ptime() {
return ptime;
}
};
typedef Customer Item;
class Queue {
private:
struct Node {
Item item;
struct Node *next;
};
enum {SIZE = 10};
Node *front;
Node *rear;
int items;
const int size;
Queue(const Queue &q): size(0) {}
Queue & operator=(const Queue &q) {return *this;}
public:
Queue(int s = SIZE);
~Queue();
bool empty() const;
bool full() const;
int get_count() const;
bool enqueue(const Item &item);
bool dequeue(Item &item);
};
#endif