/ Published in: C++
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
using namespace std; struct tklijent{ char ime[15]; char prezime[20]; char transakcija[20]; int god_rodenja; int stanje_rac; }; typedef tklijent elementtype; struct qu { elementtype value; struct qu *next; }; struct que { struct qu *front,*rear; }; typedef struct que queue; typedef struct qu *element; bool IsEmptyQ(queue *Q){ if (Q->rear == Q->front) return true; else return false; } elementtype FrontQ(queue *Q){ if (IsEmptyQ(Q)){ cout << "Red je prazan!" << endl; exit(1); } return Q->front->next->value; } void EnqueueQ(elementtype x , queue *Q){ element novi , prethodni; novi = new qu; novi->value = x; prethodni = Q->rear; prethodni->next = novi; Q->rear = novi; } void DequeueQ(queue *Q){ if (IsEmptyQ(Q)){ cout << "Red je prazan!" << endl; exit(1); } element brisi; brisi = Q->front; Q->front = brisi->next; delete(brisi); } void InitQ(queue *Q){ element e; e = new qu; e->next = NULL; Q->front = Q->rear = e; }