/ Published in: C++
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
struct klijent{ char ime[20],prezime[20]; int godina, stanje, trans; }; typedef klijent elementtype; struct qu { elementtype value; struct qu *next,*front,*rear; }; void InitQ(qu *Q) { qu *pom; pom = new qu; (*Q).front=pom; (*Q).rear=pom; (*pom).next=NULL; } void EnqueueQ( elementtype x,qu *Q) { qu *e; e=new qu; (*e).value=x; (*e).next=NULL; (*(*Q).rear).next=e; (*Q).rear=e; } elementtype FrontQ(qu *Q) { if ((*Q).front==(*Q).rear) { printf("Red je prazan"); exit(0); } else return((*(*(*Q).front).next).value); } void DequeueQ(qu *Q) { qu *e; if ((*Q).front==(*Q).rear) { printf("Red je prazan"); exit(0); } else { e=(*Q).front; (*Q).front=(*(*Q).front).next; free(e); } } int IsEmptyQ(qu *Q){ if ((*Q).front==(*Q).rear) return(1); else return(0); } //Iva Kis