Posted By


boki567 on 12/13/11

Tagged


Statistics


Viewed 116 times
Favorited by 0 user(s)

Related snippets


pokazivaci_red.h


/ Published in: C++
Save to your folder(s)

biblioteka pokazivaci_red.h


Copy this code and paste it in your HTML
  1. struct pacijent {
  2. int prior, x, y;
  3. };
  4. struct qu {
  5. pacijent el;
  6. qu *next;
  7. };
  8. struct que {
  9. qu *front, *rear;
  10. };
  11. que red;
  12.  
  13. pacijent FrontQ (que red_atp) {
  14. return ((red_atp.front)->next)->el;;
  15. }
  16. void EnQueueQ (pacijent pac, que &red_atp) {
  17. qu *novi=new qu;
  18. novi->el=pac;
  19. novi->next=NULL;
  20. (red_atp.rear)->next=novi;
  21. red_atp.rear=novi;
  22. }
  23. void DeQueueQ (que &red_atp) {
  24. qu *brisi=red_atp.front;
  25. red_atp.front=(red_atp.front)->next;
  26. delete brisi;
  27. }
  28. bool IsEmptyQ (que red_atp) {
  29. if (red_atp.rear==red_atp.front) return true;
  30. return false;
  31. }
  32. void InitQ (que &red_atp) {
  33. qu *novi=new qu;
  34. novi->next=NULL;
  35. red.rear=novi;
  36. red.front=novi;
  37. }

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.