CCCPaste

Untitled

#include 
using namespace std;
const int max_size = 1000;
struct covek
{
    string ime;
    int embr;
    bool rezultat;
    bool testiranjeSer;
    bool testiranjePCR;
};
struct Queue {
    covek niza[max_size];
    int front, rear;
    
    void init() {
        front = 0;
        rear = -1;
    }
    
    bool isEmpty() {
        if(rear == -1) {
            return true;
        }
        else {
            return false;
        }
    }
    bool isFull() {
        if(rear == max_size - 1) {
            return true;
        }
        else {
            return false;
        }
    }
    
    void push(covek element) {
        if(isFull()) {
            cout << "Redot e poln" << endl;
            return;
        }
        rear++;
        niza[rear] = element;
    }
    void pop() {
        if(isEmpty()) {
            cout << "Nema elementi vo redot" << endl;
            return;
        }
        for(int i = front; i < rear; i++) {
            niza[i] = niza[i + 1];
        }
        rear--;
    }
    covek peek() {
        if(isEmpty()) {
            cout << "Prazen red" << endl;
            exit(0);
        }
        return niza[front];
    }
    
};

void raspredeli_usluzi(Queue & lugje, Queue & rezultati, Queue & za_testiranjeSer, Queue & za_testiranjePcr) {
    
    while(!lugje.isEmpty()) {
        covek c = lugje.peek();
        lugje.pop();
        
        if(c.rezultat) {
            rezultati.push(c);
        }
        else if(c.testiranjeSer) {
            za_testiranjeSer.push(c);
        }
        else if(c.testiranjePCR) {
            za_testiranjePcr.push(c);
        }
    }
    cout << "Rezultati cekaat" << endl;
    while(!rezultati.isEmpty()) {
        covek c = rezultati.peek();
        rezultati.pop();
        
        cout << c.ime << " " << c.embr << endl;
        
        if(c.testiranjeSer) {
            za_testiranjeSer.push(c);
        }
        else if(c.testiranjePCR) {
            za_testiranjePcr.push(c);
        }
    }
    
    cout << "Za serolosko testiranje" << endl;
    while(!za_testiranjeSer.isEmpty()) {
        covek c = za_testiranjeSer.peek();
        za_testiranjeSer.pop();
        
        cout << c.ime << " " << c.embr << endl;
        if(c.testiranjePCR) {
            za_testiranjePcr.push(c);
        }
        
    }
    cout << "Za pcr testiranje" << endl;
    while(!za_testiranjePcr.isEmpty()) {
        covek c = za_testiranjePcr.peek();
        za_testiranjePcr.pop();
        
        cout << c.ime << " " << c.embr << endl;
    }
    
}
int main()
{
    
    
    
    Queue lugje, za_testiranjeSer, za_testiranjePCR, za_rezultati;
    covek pomoshen;
    char c;
    int i=1;
    lugje.init();
    za_rezultati.init();
    za_testiranjeSer.init();
    za_testiranjePCR.init();
    while(1)
    {
    cout<<"Vnesete podatoci za covek "<>pomoshen.ime>>pomoshen.embr>>pomoshen.rezultat>>pomoshen. testiranjeSer>>pomoshen.testiranjePCR;
    lugje.push(pomoshen);
    cout<>c;
    if(c == '.')
        break;
        i++;
    }
    raspredeli_usluzi(lugje, za_rezultati, za_testiranjeSer, za_testiranjePCR);
    cout<