Revision: 53736
Initial Code
Initial URL
Initial Description
Initial Title
Initial Tags
Initial Language
at December 2, 2011 07:27 by malazarev
Initial Code
#include <iostream> using namespace std; typedef int element; struct red{ int br[1000]; int front,rear; }; int AddOne(int i){ return ((i+1)%1000); } int FrontQ(red *jedan){ if(AddOne(jedan->rear)==jedan->front){ cout<<"Red je prazan!"; exit(0); } else{ return jedan->br[jedan->front]; } } void EnqueueQ(int x,red *jedan){ if(AddOne(AddOne(jedan->rear))==jedan->front){ cout<<"Red je pun!"; exit(0); }else jedan->rear=AddOne(jedan->rear); jedan->br[jedan->rear]=x; } void DequeueQ(red *jedan){ if(AddOne(jedan->rear)==jedan->front){ cout<<"Red je prazan!"; exit(0); } else{ jedan->front=AddOne(jedan->front); } } void InitQ(red *jedan){ jedan->rear=999; jedan->front=0; } int IsEmptyQ(red *jedan){ if(AddOne(jedan->rear)!=jedan->front) return 0; else return (-1); }
Initial URL
Initial Description
deskripšn
Initial Title
zaglavlje - polje
Initial Tags
Initial Language
C++