/ Published in: C++
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
#include<iostream> using namespace std; struct klijentiP{ char ime_prez[40]; int godina; int stanje; char transakcija; }; struct red{ klijentiP klijenti[1000]; red *pok,*front,*back; }; void InitQ(red *Q) { red *objekt; objekt=new red; Q->front=objekt; Q->back=objekt; objekt->pok=NULL; } klijentiP FrontQ(red *Q){ return Q->front->pok->klijenti[0]; } void EnQueueQ(klijentiP x,red *Q){ red *novi=new red; novi->pok=NULL; Q->back->pok=novi; Q->back=novi; novi->klijenti[0]=x; } void DeQueueQ(red *Q){ if (Q->back!=Q->front){ red *tekuci=Q->front; Q->front=Q->front->pok; delete tekuci; } } int IsEmptyQ(red *Q){ if (Q->back==Q->front) return 1; else return 0; }