/ Published in: C++

implementacije reda pomoću pokazivaÄa
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
struct pacijent { int prioritet; int x, x, y; }; struct tred{ pacijent pac; tred *next; }; struct que { tred *front; tred *rear; }; que red; pacijent FrontQ (que red_atp) { return red_atp.front->next->pac; } void EnQueueQ (pacijent pac, que &red_atp) { tred *novi; novi = new tred; novi->pac = pac; novi->next=NULL; red_atp.rear->next=novi; red_atp.rear=novi; } void DeQueueQ (que &red_atp) { tred *brisi; brisi = red_atp.front; red_atp.front = red_atp.front->next; delete brisi; } bool IsEmptyQ (que red_atp) { if (red_atp.rear==red_atp.front) { return true; } else { return false; } } void InitQ (que &red_atp) { tred *novi; novi = new tred; novi->next=NULL; red.rear=novi; red.front=novi; }
URL: http://snipplr.com
Comments
