Posted By


dario123 on 01/16/11

Tagged


Statistics


Viewed 69 times
Favorited by 0 user(s)

implementacija_pokazivac_db


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



Copy this code and paste it in your HTML
  1. typedef struct osoba
  2. {
  3. char imeprezime[40];
  4. int godiste;
  5. float stanje;
  6. char transakcija[30];
  7. } elemtype;
  8.  
  9.  
  10. typedef struct red
  11. {
  12. elemtype vrijednost;
  13. struct red *next;
  14. } element;
  15.  
  16.  
  17. typedef struct r
  18. {
  19. element *pocetak,*kraj;
  20. } red;
  21.  
  22.  
  23. void InitQ(red *R)
  24. {
  25. element *novi = new element;
  26. novi->next = NULL;
  27. R->pocetak = R->kraj = novi;
  28. }
  29.  
  30.  
  31. int IsEmptyQ(red *R)
  32. {
  33. if (R->pocetak == R->kraj)
  34. return 1;
  35. else
  36. return 0;
  37. }
  38.  
  39. elemtype FrontQ(red *R)
  40. {
  41. return R->pocetak->next->vrijednost;
  42. }
  43.  
  44.  
  45. void EnQueueQ(elemtype v, red *Q)
  46. {
  47. element *novi = new element;
  48. novi->vrijednost = v;
  49. novi->next = NULL;
  50. Q->kraj->next = novi;
  51. Q->kraj = novi;
  52. }
  53.  
  54.  
  55. void DeQueueQ(red *R)
  56. {
  57. element *sljedeci;
  58. sljedeci = R->pocetak;
  59. R->pocetak = R->pocetak->next;
  60. free (sljedeci);
  61. }

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.