Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- struct tclient{
- /* Osnovna struktura koja sadrzi podatke o pojedinom klijentu. */
- tClient label;
- char trans[20];
- };
- struct tqueue{
- /* */
- tclient Q[1000];
- int front, rear;
- };
- typedef struct tqueue *queue;
- typedef struct tclient *client;
- queue FrontQ(queue Q){
- return Q->Q[Q->front] ;
- }
- void EnQueueQ(client El, queue Q){
- Q->rear=((Q->rear+1)%1000);
- strcpy(Q->Q[Q->rear]->label.name, El->label.name);
- Q->Q[Q->rear]->label.year = El->label.year;
- Q->Q[Q->rear]->label.saldo = El->label.saldo;
- strcpy(Q->Q[Q->rear]->label.trans, El->label.trans);
- }
- void DeQueueQ(queue Q){
- if((Q->rear+1)%1000 == Q->front) return;
- else Q->front=((Q->front+1)%1000);
- }
- bool IsEmptyQ(queue Q){
- if( ((Q->rear+1)%1000) == (Q->front)) return true;
- else return false;
- }
- int InitQ(queue Q){
- Q->front = 0;
- Q->rear = 999;
- }
Add Comment
Please, Sign In to add comment