Return to Snippet

Revision: 53749
at December 2, 2011 10:44 by vedranvadunec


Initial Code
struct cekaonica{ 
    int broj_pacjenta;  
    int cekanje ;
    int proteklo_u_ordinaciji; 
    int prioritet;   
};
     
struct red{       
    cekaonica elementi[10001];  
    int celo; 
    int zacelje;   
};
     
int addone(int n){
    return ((n+1)%10001);
};
     
void InitQ(red *Red){   
    Red->celo=0;     
    Red->zacelje=10000;     
};

bool IsemptyQ(red *Red){
    if(addone(Red->zacelje)==Red->celo) 
    return true;
    else 
    return false;
};
    
bool EnqueueQ(cekaonica x, red *Red){
         Red->zacelje=addone(Red->zacelje);
         Red->elementi[Red->zacelje]=x;
};

void DequeueQ(red *Red){
    Red->celo=addone(Red->celo);
};

cekaonica FrontQ(red *Red){
    return (Red->elementi[Red->celo]);
};

Initial URL

                                

Initial Description
Vedran Vađunec

Initial Title
Cekaonica i pacjenti - red_polje.h

Initial Tags

                                

Initial Language
C++