Skip to content

Instantly share code, notes, and snippets.

@teramuza
Created October 14, 2019 09:43
Show Gist options
  • Save teramuza/6b1bd9f32fce10dcb9262b0c99461b59 to your computer and use it in GitHub Desktop.
Save teramuza/6b1bd9f32fce10dcb9262b0c99461b59 to your computer and use it in GitHub Desktop.
#include <iostream>
#define MAX 10
using namespace std;
struct Queue {
int front, rear, counter, data[MAX];
} Antrian;
void init() {
Antrian.rear = -1;
Antrian.front = 0;
Antrian.counter = 0;
}
bool isEmpty() {
return Antrian.counter == 0;
}
bool isFull() {
return Antrian.counter == MAX;
}
int circ(int val) {
return (val + 1) % MAX;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment