/ Published in: C++
header pokazivac
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
#include <iostream> using namespace std; struct klijent{ char ime[35]; int god; float stanje; int transakcija; }; struct element{ klijent k; element *next; }; struct queue{ element *front, *rear; }; typedef struct queue *qu; void InitQ (queue *q){ element *novi = new element; q -> front = novi; novi -> next = NULL; q -> rear = novi; } bool IsEmptyQ (queue *q){ if (q -> rear == q -> front) return true; else return false; } klijent FrontQ (queue *q){ if(IsEmptyQ(q)) cout << "Red je prazan." << endl; else return (q -> front -> next -> k); } void EnQueueQ (klijent k, queue *q){ element *novi = new element; novi -> k = k; q -> rear -> next = novi; q -> rear = novi; novi -> next = NULL; } void DeQueueQ (queue *q){ if (IsEmptyQ(q)) cout << "Red je prazan." << endl; else{ element *prvi = q -> front; q -> front = q -> front -> next; delete prvi; } }
URL: red_pokazivac