Return to Snippet

Revision: 36471
at November 22, 2010 05:21 by alsobodic


Initial Code
struct tklijent{
       char ime[50],prez[50];
       int god, stanje;
       char vrstatrans;
};

struct tRed {
    tklijent elements[1000];
    int p,z;
};

typedef struct tRed Queue;
typedef struct tklijent el;

tRed* InitQ(tRed *Q){
Q = new tRed;
Q -> p = 0;
Q -> z = 999;
return Q;
};

int AddOne(int n){
return ((n+1)%1000);
};

el FrontQ(tRed *Q){
return Q -> elements[Q -> p];
};

void EnQueueQ(el x,tRed *Q){
Q -> z = AddOne(Q -> z);
Q -> elements[Q -> z] = x;
};

void DeQueueQ(tRed *Q){
Q -> p = AddOne(Q -> p);
};

bool IsEmptyQ(tRed *Q){
if(AddOne(Q -> z) == Q -> p)
            return true;
else
    return false;
};

Initial URL

                                

Initial Description

                                

Initial Title
red_pokazivac.h

Initial Tags

                                

Initial Language
C++