Revision: 53893
Updated Code
at December 3, 2011 07:16 by zstrahij1
Updated Code
#include <cstdlib> #include <iostream> using namespace std; struct _pacijent { int broj, cekaonica, ordinacija, prioritet; }; struct _t { _pacijent pacijent; _t *sljedeci; }; struct _red { _t *front, *rear; }; void InitQ(_red *red) { red->front=(_t*)malloc(sizeof(_t)); red->front->sljedeci=NULL; red->rear=red->front; cout<<"Red inicijaliziran!"<<endl; }; bool IsEmptyQ(_red *red) { if(red->front==red->rear) return true; else return false; }; void EnQueueQ(_pacijent pacijent,_red *red) { _t *temp; temp=new _t; temp->pacijent=pacijent; temp->sljedeci=NULL; red->rear->sljedeci=c; red->rear=temp; }; void DeQueueQ(_red *red) { _t *temp; if(IsEmptyQ(red)) cout<<"Red prazan!"<<endl; else { temp=red->front; red->front=red->front->sljedeci; free(temp); } }; _pacijent FrontQ(_red *red) { if(IsEmptyQ(red)) cout<<"Red prazan!"<<endl; else return (red->front->sljedeci->pacijent); }
Revision: 53892
Initial Code
Initial URL
Initial Description
Initial Title
Initial Tags
Initial Language
at December 3, 2011 05:35 by zstrahij1
Initial Code
#include <cstdlib> #include <iostream> using namespace std; struct _pacijent { int broj, cekaonica, ordinacija, prioritet; }; struct t { _pacijent pacijent; t *sljedeci; }; struct _red { t *front, *rear; }; void InitQ(_red *red) { red->front=(t*)malloc(sizeof(t)); red->front->sljedeci=NULL; red->rear=red->front; cout<<"Red inicijaliziran!"<<endl; }; bool IsEmptyQ(_red *red) { if(red->front==red->rear) return true; else return false; }; void EnQueueQ(_pacijent pacijent,_red *red) { t *pom; pom=new t; pom->pacijent=pacijent; pom->sljedeci=NULL; red->rear->sljedeci=pom; red->rear=pom; }; void DeQueueQ(_red *red) { t *pom; if(IsEmptyQ(red)) cout<<"Red prazan!"<<endl; else { pom=red->front; red->front=red->front->sljedeci; free(pom); } }; _pacijent FrontQ(_red *red) { if(IsEmptyQ(red)) cout<<"Red prazan!"<<endl; else return (red->front->sljedeci->pacijent); }
Initial URL
Initial Description
Header pokazivaci
Initial Title
red_pokazivac.h
Initial Tags
podataka
Initial Language
C++