Return to Snippet

Revision: 36388
at November 21, 2010 09:00 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 queue {
       klijent K[1000];
       int celo,zacelje;
};
typedef struct queue red;
int AddOne(int n) {
    return ((n+1)%1000);
};
klijent FrontQ(red *R) {
        if(AddOne(R->zacelje)!=R->celo)
        return R->K[R->celo];
        else {
             cout << "Red je prazan!" << endl; 
             exit(1);
        }
};
void EnQueueQ(klijent k,red *R) {
     if (AddOne(AddOne(R->zacelje))!=R->celo) {
        R->zacelje=AddOne(R->zacelje);
        R->K[R->zacelje]=k;
     }
     else {
          cout << "Red je pun!" << endl;
          return; 
     }
};
void DeQueueQ(red *R) {
     if (AddOne(R->zacelje)!=R->celo)
     R->celo=AddOne(R->celo);
     else {
          cout << "Red je prazan!" << endl;
          return;
     }
};
red *InitQ(red *R) {
    R=new red;
    R->zacelje=9999;
    R->celo=0;
    return R;
};
bool IsEmptyQ(red *R) {
     if(AddOne(R->zacelje)==R->celo)
     return true;
     else
     return false;
};

Initial URL


Initial Description


Initial Title
Implementacija reda pomoću cirkularnog polja

Initial Tags
podataka

Initial Language
C++