Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // kolejka
- #ifndef QUEUE1_H_
- #define QUEUE1_H_
- class Customer
- {
- private:
- long arrive; // czas dolaczenia klienta do kolejki
- int processtime; // czas obslugi klienta
- public:
- Customer() { arrive = processtime = 0; }
- void set(long when); // ustawia losowo processtime
- long when() const { return arrive; } // kiedy dolaczyl do kolejki
- int ptime() const { return processtime; } // ile czasu spedzi przy bankomacie
- };
- typedef Customer Item;
- class Queue
- {
- private:
- struct Node
- {
- Item item;
- struct Node * next;
- };
- Node * front;
- Node * rear;
- int items;
- enum { Q_SIZE = 10 };
- const int qsize;
- public:
- Queue(int qs = Q_SIZE);
- ~Queue();
- Item & firstin() { if (front != nullptr) return front->item; }
- bool isempty();
- bool isfull();
- int queuecount() const;
- bool enqueue(const Item & item);
- bool dequeue(Item & item);
- friend bool operator>(const Queue & q1, const Queue & q2);
- friend bool operator<(const Queue & q1, const Queue & q2);
- };
- #endif // !QUEUE_H_
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement