Return to Snippet

Revision: 36489
at November 22, 2010 08:07 by mesec


Initial Code
#include <iostream>
using namespace std;

struct klijent{
       char ime[35];
       int god;
       float stanje;
       int transakcija;
};

struct element{
       klijent k;
       element *next;
};

struct queue{
       element *front, *rear;
};

typedef struct queue *qu;

void InitQ (queue *q){
     element *novi = new element;
     q -> front = novi;
     novi -> next = NULL;
     q -> rear = novi;
}

bool IsEmptyQ (queue *q){
     if (q -> rear == q -> front) return true;
     else return false;
}

klijent FrontQ (queue *q){
        if(IsEmptyQ(q)) cout << "Red je prazan." << endl;
        else return (q -> front -> next -> k);
}

void EnQueueQ (klijent k, queue *q){
     element *novi = new element;
     novi -> k = k;
     q -> rear -> next = novi;
     q -> rear = novi;
     novi -> next = NULL;
}

void DeQueueQ (queue *q){
     if (IsEmptyQ(q)) cout << "Red je prazan." << endl;
     else{
          element *prvi = q -> front;
          q -> front = q -> front -> next;
          delete prvi;
     }
}

Initial URL
red_pokazivac

Initial Description
header pokazivac

Initial Title
red_pokazivac.h

Initial Tags


Initial Language
C++