Posted By

danacc on 11/21/10


Tagged

dasacer


Versions (?)

red.pokazivac.h


 / Published in: C++
 

  1. #include<iostream>
  2. using namespace std;
  3. struct klijentiP{
  4. char ime_prez[40];
  5. int godina;
  6. int stanje;
  7. char transakcija;
  8. };
  9.  
  10. struct red{
  11. klijentiP klijenti[1000];
  12. red *pok,*front,*back;
  13. };
  14.  
  15. void InitQ(red *Q)
  16. {
  17. red *objekt;
  18. objekt=new red;
  19. Q->front=objekt;
  20. Q->back=objekt;
  21. objekt->pok=NULL;
  22. }
  23. klijentiP FrontQ(red *Q){
  24. return Q->front->pok->klijenti[0];
  25. }
  26. void EnQueueQ(klijentiP x,red *Q){
  27. red *novi=new red;
  28. novi->pok=NULL;
  29. Q->back->pok=novi;
  30. Q->back=novi;
  31. novi->klijenti[0]=x;
  32. }
  33. void DeQueueQ(red *Q){
  34. if (Q->back!=Q->front){
  35. red *tekuci=Q->front;
  36. Q->front=Q->front->pok;
  37. delete tekuci;
  38. }
  39. }
  40. int IsEmptyQ(red *Q){
  41. if (Q->back==Q->front)
  42. return 1;
  43. else
  44. return 0;
  45. }

Report this snippet  

You need to login to post a comment.