Return to Snippet

Revision: 53737
at December 2, 2011 07:28 by malazarev


Initial Code
#include <iostream>

using namespace std;

typedef int element;

struct red{
       int br;
       red *slijedeci;
       red *front,*rear;
       };
       
   
typedef struct red *ele;

int FrontQ(red *jedan){
    if(jedan->rear!=jedan->front)
  return jedan->front->slijedeci->br;
    else{
         cout<<"Red je prazan!";
         exit(0);
         }
    }
    
void EnqueueQ(int x,red *jedan){
     
    red *novi=new red;
    novi->br=x;
    novi->slijedeci=NULL;
    jedan->rear->slijedeci=novi;
    jedan->rear=novi;
     
     }
     

void DequeueQ(red *jedan){

red *brisani=new red;
  if(jedan->rear!=jedan->front){
  brisani=jedan->front;
  jedan->front=brisani->slijedeci;
  delete brisani;
 
  }else{
        cout<<"Red je prazan!";
        exit(0);
        }
     
     }
     
     
void InitQ(red *jedan){
     
     red*novi=new red;
     jedan->rear=novi;
     jedan->front=novi;
     novi->slijedeci=NULL;
     
     }
     
     
int IsEmptyQ(red *jedan){
    if(jedan->front==jedan->rear)
    return (-1);
    else
    return 0;
    
    }

Initial URL

                                

Initial Description
deskripšn

Initial Title
zaglavlje - pokazivaci

Initial Tags
podataka

Initial Language
C++