Return to Snippet

Revision: 53917
at December 3, 2011 06:14 by mjurman


Initial Code
#include <iostream>
using namespace std;
    
struct pacijent {
    int x, y;
    short pac_prioritet;
};
     
struct qu {
    pacijent value;
    qu *next;
};
     
struct que {
    qu *front, *rear;
};
     
typedef struct que red;
typedef struct qu element;
element *glava=new element;
     
bool IsEmptyQ(red *Q) {
    if (Q->rear==Q->front) return true;
    else return false;
}
     
pacijent FrontQ(red *Q) {
    if (!IsEmptyQ(Q)) {
       element *pom=Q->front;
       pom=pom->next;
       return pom->value;
    }
}
     
void DeQueueQ(red *Q) {
    if (!IsEmptyQ(Q)) {
       element *brisi=Q->front;
       Q->front=brisi->next;
       delete brisi;
    }
}
     
void EnQueueQ (pacijent x, red *Q) {
    element *zadnji=Q->rear;
    element *novi=new element;
    novi->value=x;
    novi->next=NULL;
    zadnji->next=novi;
    Q->rear=novi;
}
     
void InitQ (red *Q) {
    Q->front=glava;
    Q->rear=glava;
}

Initial URL
http://snipplr.com

Initial Description
implementacija reda pomocu pokazivaca

Initial Title
Red_pokazivac.h

Initial Tags
podataka

Initial Language
C++