| 22 | } |
| 23 | |
| 24 | void Enqueue(int x) |
| 25 | { |
| 26 | if ((rear + 1) % SIZE == front) |
| 27 | { |
| 28 | return; |
| 29 | } |
| 30 | else if (IsEmpty()) |
| 31 | { |
| 32 | front = 0; |
| 33 | rear = 0; |
| 34 | |
| 35 | queue[rear] = x; |
| 36 | } |
| 37 | else |
| 38 | { |
| 39 | rear = (rear + 1) % SIZE; |
| 40 | queue[rear] = x; |
| 41 | } |
| 42 | } |
| 43 | |
| 44 | void Dequeue() |
| 45 | { |