Return to Snippet

Revision: 53878
at December 3, 2011 04:57 by ikovic


Initial Code
#include <cstdlib>
#include <iostream>
 
using namespace std;
 
 
struct tpacijent
{      int rbp;
       int x;
       int y; 
       int z;      
       };
 
struct t{
       tpacijent vrij;
       t *sljedeci;
       };
 
struct q{
       t *front, *rear;
       };
 
void initq(q *queue){
     queue->front=(t*)malloc(sizeof(t));
     queue->front->sljedeci=NULL;
     queue->rear=queue->front;
     };
 
bool isemptyq(q*queue){
     if(queue->front==queue->rear) return true;
     else return false;
     };
 
void enqueueq(tpacijent x,q *queue){
     t *pom;
     pom=new t;
     pom->vrij=x;
     pom->sljedeci=NULL;
     queue->rear->sljedeci=pom;
     queue->rear=pom;
     };
 
void dequeueq(q*queue){
     t *pom;
     if(isemptyq(queue)) cout<<"Red je prazan";
     else{
          pom=queue->front;
          queue->front=queue->front->sljedeci;
          free(pom);
          }
     };
 
tpacijent frontq(q *queue){
       if(isemptyq(queue)) cout<<"Red je prazan";
       else return (queue->front->sljedeci->vrij);
       };

Initial URL
/

Initial Description
Implementacija reda pokazivačima

Initial Title
red_pokazivaci.h

Initial Tags
c++

Initial Language
C++