红u pokazivaci.h
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了红u pokazivaci.h相关的知识,希望对你有一定的参考价值。
Simulacija reda u lijeÄniÄkoj ordinaciji - red_pokazivaci.h
struct tdata{ int x,y, prioritet, rb; tdata *next; }; struct tlist{ tdata *front; tdata *rear; }; bool IsEmptyQ(tlist *Q){ if(Q->front==Q->rear) return true; return false; } tdata FronQ(tlist *Q){ tdata data; data.x = 0; data.y = 0; data.rb = 0; data.prioritet = 0; if(IsEmptyQ(Q)) return data; return *Q->front->next; } void EnQueueQ(tdata x,tlist *Q){ tdata *novi = new tdata; memcpy(novi,&x,sizeof(tdata)); novi->next = NULL; if(IsEmptyQ(Q)){ Q->front->next = novi; Q->rear = novi; } else { Q->rear->next = novi; Q->rear = novi; } } bool DeQueueQ(tlist *Q){ if(IsEmptyQ(Q)) return false; tdata *first = Q->front->next; if(first->next) Q->front->next = first->next; else Q->front = Q->rear; } tlist* InitQ(tlist *Q){ Q = new tlist; Q->front = new tdata; Q->front->next = NULL; Q->rear = Q->front; return Q; }
以上是关于红u pokazivaci.h的主要内容,如果未能解决你的问题,请参考以下文章