/ Published in: C++
Zaglavlje.
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
struct osoba { int a, x, y; }; struct qu { osoba el; qu *next; }; struct que { qu *front, *rear; }; que red; osoba FrontQ (que red) { return ((red.front)->next)->el;; } void DeQueueQ (que &red) { qu *brisi=red.front; red.front=(red.front)->next; delete brisi; } void EnQueueQ (osoba x, que &red) { qu *novi=new qu; novi->el=x; novi->next=NULL; (red.rear)->next=novi; red.rear=novi; } bool IsEmptyQ (que red) { if (red.rear==red.front) return true; return false; } void InitQ (que &red) { qu *novi=new qu; novi->next=NULL; red.rear=novi; red.front=novi; }