Return to Snippet

Revision: 53936
at December 3, 2011 07:34 by davucina


Initial Code
struct tpacijent {
       int Xi, Yi, P;
       };

struct qu {
       tpacijent element;
       qu *sljedeci;
       };

struct tred {
       qu *front, *rear;
       };

tred red;

tpacijent FrontQ (tred red) {
      return ((red.front)->sljedeci)->element;
      }

void EnQueueQ (tpacijent x, tred &red) {
     qu *novi = new qu;
     novi->element = x;
     novi->sljedeci = NULL;
     (red.rear)->sljedeci = novi;
     red.rear = novi;
     }

void DeQueueQ (tred &red) {
     qu *pom = red.front;
     red.front = (red.front)->sljedeci;
     delete pom;
     }

void InitQ (tred &red) {
     qu *novi = new qu;
     novi->sljedeci = NULL;
     red.rear = novi;
     red.front = novi;
     }

bool IsEmptyQ (tred red) {
     if (red.rear==red.front) return true;
     else return false;
     }

Initial URL

                                

Initial Description
Implementacija reda pomoću pokazivača.

Initial Title
red_pokazivac.h

Initial Tags
podataka

Initial Language
C++