Revision: 36341
Initial Code
Initial URL
Initial Description
Initial Title
Initial Tags
Initial Language
at November 20, 2010 22:04 by Wrajzen
Initial Code
#include<iostream>
using namespace std;
struct klijent{
char prez_ime[50], transakcija[50];
int god;
double stanje;
};
struct tred{
klijent klijenti;
tred *sljedeci;
tred *rear;
};
typedef struct tred *red;
tred *Q = new tred;
tred *P = new tred;
bool IsEmptyQ(tred *Qu){
if(Qu->sljedeci == NULL) return 1;
else return 0;
}
klijent FrontQ(tred *Qu){
if(IsEmptyQ(Qu)) cout << endl << "Red je prazan! " << endl;
else{
tred *front = Qu->sljedeci;
return front->klijenti;
}
}
void EnQueueQ(klijent x, tred *Qu){
tred *novi = new tred, *zajnji = Qu->rear;
novi -> klijenti = x;
novi -> sljedeci = NULL;
if(IsEmptyQ(Qu))
Qu->sljedeci = novi;
else
zajnji->sljedeci = novi;
Qu->rear = novi;
}
void DeQueueQ(tred *Qu){
if(IsEmptyQ(Qu)) cout << endl << "Red je prazan! " << endl;
else{
tred *sljedeci = Qu->sljedeci, *front = sljedeci->sljedeci;
delete sljedeci;
Qu->sljedeci = front;
}
}
void InitQ(tred *Qu){
Qu->sljedeci = NULL;
Qu->rear = NULL;
}
Initial URL
Initial Description
Initial Title
red_pokazivaci.h
Initial Tags
Initial Language
C++