Posted By


datomala on 11/21/10

Tagged


Statistics


Viewed 434 times
Favorited by 0 user(s)

red_pokazivaci.h


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



Copy this code and paste it in your HTML
  1. #include<iostream>
  2. using namespace std;
  3.  
  4. struct tklijent {
  5. char prez_ime[20];
  6. int godiste;
  7. float stanje;
  8. char transakcija[15];
  9. }klijent;
  10.  
  11. struct element {
  12. tklijent podaci;
  13. element *sljedeci;
  14. };
  15.  
  16. struct tred {
  17. element *front, *rear;
  18. }red;
  19.  
  20. void InitQ(tred *red) {
  21. element *novi=new element;
  22. red->front=novi;
  23. red->rear=novi;
  24. novi->sljedeci=NULL;
  25. }
  26.  
  27. bool IsEmptyQ(tred *red) {
  28. if(red->rear == red->front)
  29. return true;
  30. else
  31. return false;
  32. }
  33.  
  34. tklijent FrontQ(tred *red) {
  35. return red->front->sljedeci->podaci;
  36. }
  37.  
  38. void EnQueueQ(tklijent x, tred *red) {
  39. element *novi=new element;
  40. novi->podaci=x;
  41. novi->sljedeci=NULL;
  42. red->rear->sljedeci=novi;
  43. red->rear=novi;
  44. }
  45.  
  46. void DeQueueQ(tred *red) {
  47. element *brisi;
  48. brisi = red->front;
  49. red->front = red->front->sljedeci;
  50. delete brisi;
  51. }

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.