Return to Snippet

Revision: 36495
at November 22, 2010 09:09 by Nikolak


Initial Code
//Nikola Karimovic
      //Strukture podataka zadatak 3
      //Glavni  dio  programa
      #include<iostream>
      using namespace std;
       
      struct tbanka{
      char ime_prezime[50];
      char transakcije[50];
      int godine;
      int racun;
      };
       
      struct tred{
      tbanka elem;
      tred *iduci;
      };
       
      struct red{
      tred *prvi,*zadnji;
      };
      typedef struct tbanka element;
      typedef struct red Queue;
       
      red* InitQ(red *R){
      tred *novi=new tred;
      R = new red;
      R->prvi=novi;
      R->zadnji=novi;
      novi->iduci=NULL;
      return R;
      }
       
      tbanka FrontQ(red *R){
      if(R->prvi==R->zadnji){
      cout<<"Red je prazan "<<endl;
      }
      else
      return R->prvi->iduci->elem;
      }
       
      void EnQueueQ(tbanka x, red *R){
      tred *novi=new tred;
      novi->elem = x;
      novi->iduci=NULL;
      R->zadnji->iduci=novi; 
      R->zadnji=novi; 
      }
       
      void DeQueueQ(red *R){
      if(R->prvi==R->zadnji){
      cout<<"Red je prazan "<<endl;
      }
      else{

      tred *brisi = R->prvi;
      R->prvi = R->prvi->iduci;
      delete brisi;}
      }
       
      int IsEmptyQ(red *R){
      if(R->prvi==R->zadnji){
      return 1;}
      else{
      return 0;}
      }

Initial URL

                                

Initial Description

                                

Initial Title
Strukture podataka zadatak 3  header pokazivaci

Initial Tags

                                

Initial Language
C++