Revision: 53904
Initial Code
Initial URL
Initial Description
Initial Title
Initial Tags
Initial Language
at December 3, 2011 06:01 by mladenberakovic
Initial Code
#include <iostream> using namespace std; struct struktura{ int x, y; struktura *slijedeci; }; struct strukturaP{ struktura *front,*rear; }; typedef strukturaP queue; typedef struktura atrib; queue *InitQ(queue *&Q){ Q=new queue; atrib *novi=new atrib; Q->front=novi; Q->rear=novi; novi->slijedeci=NULL; return Q; }; atrib FrontQ(queue *Q){ atrib pom; pom.x=pom.y=-1; if(Q->rear != Q->front){ pom.x=Q->front->slijedeci->x; pom.y=Q->front->slijedeci->y; } return pom; }; void EnQueueQ(atrib x, queue *Q){ atrib *novi=new atrib; novi->x=x.x; novi->y=x.y; novi->slijedeci=NULL; Q->rear->slijedeci=novi; Q->rear=novi; }; void DeQueueQ(queue *Q){ if(Q->rear != Q->front){ atrib *pom=Q->front; Q->front=Q->front->slijedeci; delete pom; } else cout<<"Prazan red!"<<endl; }; bool IsEmptyQ(queue *Q){ if(Q->rear != Q->front) return false; return true; };
Initial URL
Initial Description
Zadatak 3 - Strukture Podataka
Initial Title
red_pokazivac.h
Initial Tags
Initial Language
C++