/ Published in: C++
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
typedef struct osoba { char imeprezime[40]; int godiste; float stanje; char transakcija[30]; } elemtype; typedef struct red { elemtype vrijednost; struct red *next; } element; typedef struct r { element *pocetak,*kraj; } red; void InitQ(red *R) { element *novi = new element; novi->next = NULL; R->pocetak = R->kraj = novi; } int IsEmptyQ(red *R) { if (R->pocetak == R->kraj) return 1; else return 0; } elemtype FrontQ(red *R) { return R->pocetak->next->vrijednost; } void EnQueueQ(elemtype v, red *Q) { element *novi = new element; novi->vrijednost = v; novi->next = NULL; Q->kraj->next = novi; Q->kraj = novi; } void DeQueueQ(red *R) { element *sljedeci; sljedeci = R->pocetak; R->pocetak = R->pocetak->next; free (sljedeci); }