Return to Snippet

Revision: 35950
at November 16, 2010 11:11 by ivamilice


Updated Code
#include<iostream>
using namespace std;
struct auto{
          int serial, godina;
          char proizvodac[50], model[50];
          };
typedef auto element;
struct el{
          element value;
          struct el *next;
        };
typedef struct el stog;
element TopS(stog *s){
            stog *top;
            if(s->next==NULL){
                cout<<" Greska! "<<endl;
                exit(1);
                };
            top=s->next;
            return top->value;
            };
void PushS(element z, stog *s){
          stog *novi;
          novi=(stog *)malloc(sizeof(stog));
          novi->value=z;
          novi->next=s->next;
          s->next=novi;
        };
void PopS(stog *s){
      stog *temp;
      if(s->next==NULL){
          cout<<" Greska! "<<endl;
          exit(1);
          };
      temp=s->next;
      s->next=temp->next;
      free(temp);
      };
stog * InitS(void){
          stog *s;
          s=(stog *)malloc(sizeof(stog));
          s->next=NULL;
          return s;
          };
int IsEmptyS(stog *s){
          if(s->next==NULL) return 1;
          else return 0;
          };

Revision: 35949
at November 16, 2010 11:05 by ivamilice


Updated Code
#include<iostream>
using namespace std;
struct auto{
          int serial, godina;
          char proizvodac[50], model[50];
          };
typedef auto element;
struct dva{
          element value;
          struct dva *next;
        };
typedef struct dva stog;
element TopS(stog *s){
            stog *top;
            if(s->next==NULL){
                cout<<" Greska! "<<endl;
                exit(1);
                };
            top=s->next;
            return top->value;
            };
void PushS(element z, stog *s){
          stog *novi;
          novi=(stog *)malloc(sizeof(stog));
          novi->value=z;
          novi->next=s->next;
          s->next=novi;
        };
void PopS(stog *s){
      stog *temp;
      if(s->next==NULL){
          cout<<" Greska! "<<endl;
          exit(1);
          };
      temp=s->next;
      s->next=temp->next;
      free(temp);
      };
stog * InitS(void){
          stog *s;
          s=(stog *)malloc(sizeof(stog));
          s->next=NULL;
          return s;
          };
int IsEmptyS(stog *s){
          if(s->next==NULL) return 1;
          else return 0;
          };

Revision: 35948
at November 15, 2010 09:28 by ivamilice


Initial Code
#include<iostream>
using namespace std;
struct auto{
          int serial, godina;
          char proizvodac[50], model[50];
          };
typedef auto element;
struct dva{
          element value;
          struct dva *next;
        };
typedef struct dva stog;
element TopS(stog *s){
            stog *top;
            if(s->next==NULL){
                cout<<" Greska! "<<endl;
                exit(1);
                };
            top=L->next;
            return top->value;
            };
void PushS(element z, stog *s){
          stog *novi;
          novi=(stog *)malloc(sizeof(stog));
          novi->value=z;
          novi->next=s->next;
          s->next=novi;
        };
void PopS(stog *s){
      stog *temp;
      if(s->next==NULL){
          cout<<" Greska! "<<endl;
          exit(1);
          };
      temp=s->next;
      s->next=temp->next;
      free(temp);
      };
stog * InitS(void){
          stog *s;
          s=(stog *)malloc(sizeof(stog));
          s->next=NULL;
          return s;
          };
int IsEmptyS(stog *s){
          if(s->next==NULL) return 1;
          else return 0;
          };

Initial URL


Initial Description


Initial Title
Implementacija stoga pomoću polja

Initial Tags


Initial Language
C++