Return to Snippet

Revision: 53953
at December 3, 2011 09:02 by giga_games


Initial Code
struct pacijent {
    int prioritet;
    int x, x, y;
};

struct tred{
    pacijent pac;
    tred *next;
};

struct que {
    tred *front;
    tred *rear;
};

que red;
     
pacijent FrontQ (que red_atp) {
    return red_atp.front->next->pac;
}

void EnQueueQ (pacijent pac, que &red_atp) {
    tred *novi;
    novi = new tred;
    novi->pac = pac;
    novi->next=NULL;

    red_atp.rear->next=novi;
    red_atp.rear=novi;
}

void DeQueueQ (que &red_atp) {
    tred *brisi;
    brisi = red_atp.front;
    red_atp.front = red_atp.front->next;
    delete brisi;
}

bool IsEmptyQ (que red_atp) {
    if (red_atp.rear==red_atp.front) {
         return true;
    }
    else {
        return false;
    }
}

void InitQ (que &red_atp) {
    tred *novi; 
    novi = new tred;
 
   novi->next=NULL;
    red.rear=novi;
    red.front=novi;
}

Initial URL
http://snipplr.com

Initial Description
implementacije reda pomoću pokazivača

Initial Title
red_pokazivac.h

Initial Tags


Initial Language
C++