/ Published in: C++
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
struct klijent { char ime[20]; char prezime[20]; int godina; float stanje; int transakcija; }; struct elementreda { klijent value; elementreda *next; }; struct tred { elementreda *front, *rear; }; typedef struct tred *pred; klijent FrontQ(tred *Q) { if (Q->front == Q->rear) { klijent x; x.godina = 0; x.stanje = 0; x.transakcija = 0; return x; } else return Q->front->next->value; } void EnQueueQ(klijent x, tred *Q) { elementreda *e = new elementreda; e->value = x; e->next = NULL; Q->rear->next = e; Q->rear = e; } void DeQueueQ(tred *Q) { elementreda *e; if (Q->front != Q->rear) { e = Q->front; Q->front = Q->front->next; delete e; } } void InitQ(tred *Q) { elementreda *e = new elementreda; Q->front = e; Q->rear = e; e->next = NULL; } bool IsEmptyQ(tred *Q) { if (Q->front == Q->rear) return true; else return false; }