Return to Snippet

Revision: 36345
at November 20, 2010 23:47 by dapatafta


Initial Code
struct klijent 							
{
	char ime[20];			
	char prezime[20];			
	int godina;							
	float stanje;						
	int transakcija;							
};

struct elementreda 						
{
	klijent value;						
	elementreda *next;					
};

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

typedef struct tred *pred;				

klijent FrontQ(tred *Q)					
{
	if (Q->front == Q->rear)			
	{
        klijent x;						
        x.godina = 0;					
        x.stanje = 0;
        x.transakcija = 0;
        
        return x;
    }
    else
    	return Q->front->next->value;	
}

void EnQueueQ(klijent x, tred *Q)		
{
	elementreda *e = new elementreda;	
    e->value = x;						
    e->next = NULL;						
    Q->rear->next = e;					
    Q->rear = e;						
}

void DeQueueQ(tred *Q)				
{
	elementreda *e;						
	
	if (Q->front != Q->rear)			
	{
		e = Q->front;					
		Q->front = Q->front->next;	
		delete e;						
    }
}

void InitQ(tred *Q) 					
{
	elementreda *e = new elementreda;	
    Q->front = e;					
    Q->rear = e;						
    e->next = NULL;						
    									
}

bool IsEmptyQ(tred *Q)				
{
     if (Q->front == Q->rear)			
     	return true;				
     else
	 	return false;				
}

Initial URL

                                

Initial Description

                                

Initial Title
red_pokazivac.h

Initial Tags

                                

Initial Language
C++