Posted By


ikukec on 12/02/11

Tagged


Statistics


Viewed 512 times
Favorited by 0 user(s)

red_pokazivac.h


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

Zaglavlje.


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

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.