/ Published in: C++
Expand |
Embed | Plain Text
#include <iostream> using namespace std; struct tpodaci { char ime[30]; int godina; float stanje; char transakcija; }; struct red { tpodaci podaci[10000]; int front,rear; }; int AddOne(int i) { return ((i+1)%10000); } void InitQ(red *qu) { qu->front=0; qu->rear=10000-1; } int IsEmptyQ(red *qu) { if(AddOne(qu->rear)==qu->front) return 1; else return 0; } tpodaci FrontQ(red *qu) { if(IsEmptyQ(qu)) cout<<"Red je prazan"<<endl; else return qu->podaci[qu->front]; } void EnQueueQ(tpodaci x,red *qu) { qu->rear=AddOne(qu->rear); qu->podaci[qu->rear]=x; } void DeQueueQ(red *qu) { qu->front=AddOne(qu->front); }
You need to login to post a comment.
