Return to Snippet

Revision: 36342
at November 20, 2010 22:04 by anja2pet


Initial Code
struct que{
       elementtype value;
	   que *next;
};
struct qu{
       que *front,*rear;
};

elementtype FrontQ(qu *Q) {
	if (Q->front==Q->rear){
		cout << "\n Red je prazan ! \n";
		exit(0);
        }
    else
		return Q->front->next->value;       
}
void EnQueueQ(elementtype x,qu *Q) {
	que *e=new que;
	e->value=x;
	e->next=NULL;
	Q->rear->next=e;
	Q->rear=e;
}
void DeQueueQ(qu *Q) {
	que *e;
	if(Q->front==Q->rear){
		cout << "\n Red je prazan ! \n";
		exit(0);
    }
	else {
		e=Q->front;
		Q->front=Q->front->next;
		delete e;
}}
void InitQ(qu *Q) {
	que *e=new que;
	Q->front=e;
	Q->rear=e;
	e->next=NULL;
}
int IsEmptyQ(qu *Q){
	if (Q->front==Q->rear)
		return 1;
	else 
		return 0;
}

Initial URL

                                

Initial Description

                                

Initial Title
red_pokazivac.h

Initial Tags

                                

Initial Language
C++