Return to Snippet

Revision: 36389
at November 21, 2010 09:03 by kresimir20


Initial Code
#include <iostream>
#include <cstring>
using namespace std;
struct zapis {
       string preime;
       int god,transakcija;
       double stanje_racuna;
};
typedef zapis klijent;
struct que {
       klijent K;
       que *next;
};
struct queue {
       que *celo,*zacelje;
};
typedef struct queue red;
klijent FrontQ(red *Q) {
        if (Q->celo!=Q->zacelje)
        return(Q->celo->next->K);
        else {
             cout << "Red je prazan!" << endl;
             exit(1);
        }
};
void EnQueueQ(klijent K,red *Q) {
     que *novi=new que;
     novi->K=K;
     novi->next=NULL;
     Q->zacelje->next=novi;
     Q->zacelje=novi;
};
void DeQueueQ(red *Q) {
     if (Q->celo!=Q->zacelje) {
        que *pom=Q->celo;
        Q->celo=Q->celo->next;
        delete pom;
     }
     else {
          cout << "Red je prazan!" << endl;
          return;
     }
};
queue *InitQ(red *Q) {
      Q=new red;
      que *novi=new que;
      Q->celo=novi;
      Q->zacelje=novi;
      novi->next=NULL;
      return Q;
};
bool IsEmptyQ(red *Q) {
     if (Q->celo==Q->zacelje)
     return true;
     else
     return false;
};

Initial URL


Initial Description


Initial Title
Implementacija reda pomoću pokazivača

Initial Tags
podataka

Initial Language
C++