Created
July 15, 2008 18:55
-
-
Save maddox/5 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
#include <cstring> | |
//#include "stog_polje.h" | |
#include "stog_pokazivac.h" | |
using namespace std; | |
stack *kamion = new stack; | |
void ukrcaj(stack *S){ | |
int serial, godiste; | |
string proizvodjac,model; | |
cout<<"Proizvodjac: "; | |
cin.ignore(); | |
cin.clear(); | |
getline(cin,proizvodjac, '\n'); | |
char jos; | |
do{ | |
cout<<"Model: "; | |
getline(cin,model, '\n'); | |
cout<<"Serijski broj:"; | |
cin>>serial; | |
do{ | |
cout<<"Godiste: "; | |
cin>>godiste; | |
if(godiste<1995||godiste>2010) | |
cout<<"Mora biti između 1995-2010" << endl; | |
}while(godiste<1995||godiste>2010); | |
PushS(serial,proizvodjac,model,godiste,S); | |
cout<<"Zelite li jos unositi modela?" << endl; | |
cin>>jos; | |
cin.ignore(); | |
}while(jos=='d'); | |
} | |
void iskrcaj_2006(stack *S){ | |
cout<<"Ispis svih automobila novijih od 2006 koji nisu Audi\n"; | |
cout<<"-----------------------------------------\n"; | |
stack *pom=new stack; | |
InitS(pom); | |
int godiste, serial; | |
string proizvodjac, model; | |
while(!IsEmptyS(S)){ | |
TopS(*S,&proizvodjac,&model,&serial,&godiste); | |
if(godiste>2006&&proizvodjac.compare("Audi")!=0){ | |
cout<< endl <<"Serijski broj: "<<serial<<endl; | |
cout<<"Proizvodjac: "<<proizvodjac<<endl; | |
cout<<"Model: "<<model<<endl; | |
cout<<"Godiste: "<<godiste<<endl; | |
} | |
PushS(serial,proizvodjac,model,godiste,pom); | |
PopS(S); | |
} | |
stack *pom2=new stack; | |
InitS(pom2); | |
while(!IsEmptyS(pom)){ | |
TopS(*pom,&proizvodjac,&model,&serial,&godiste); | |
PushS(serial,proizvodjac,model,godiste,S); | |
PushS(serial,proizvodjac,model,godiste,pom2); | |
PopS(pom); | |
} | |
cout<<"========================================" << endl; | |
cout<<"Ispisivanje stanja" << endl; | |
cout<<"========================================" << endl; | |
while(!IsEmptyS(pom2)){ | |
TopS(*pom2,&proizvodjac,&model,&serial,&godiste); | |
cout<< endl << "Serijski broj: "<<serial<<endl; | |
cout<<"Proizvodjac: "<<proizvodjac<<endl; | |
cout<<"Model: "<<model<<endl; | |
cout<<"Godiste: "<<godiste<<endl; | |
PopS(pom2); | |
} | |
delete pom,pom2; | |
} | |
void rekurzija(stack *S){ | |
int godiste, serial; | |
string proizvodjac, model; | |
if(!IsEmptyS(S)){ | |
TopS(*S,&proizvodjac,&model,&serial,&godiste); | |
cout<< endl << "Serijski broj: "<<serial<<endl; | |
cout<<"Proizvodjac: "<<proizvodjac<<endl; | |
cout<<"Model: "<<model<<endl; | |
cout<<"Godiste: "<<godiste<<endl; | |
PopS(S); | |
rekurzija(S); | |
PushS(serial,proizvodjac,model,godiste,S); | |
} | |
} | |
void izbornik(){ | |
cout<<"1. Ukrcaj automobil" << endl; | |
cout<<"2. Iskrcaj sve automobile u prvoj robnoj kuci >2006 godiste-non Audi" << endl; | |
cout<<"3. Iskrcaj sve automobile u drugoj robnoj kuci" << endl; | |
cout<<"9. Izlaz" << endl; | |
} | |
int main(){ | |
InitS(kamion); | |
int izbor; | |
do{ | |
izbornik(); | |
cin>>izbor; | |
switch(izbor){ | |
case 1:{ | |
ukrcaj(kamion); | |
break;} | |
case 2: | |
iskrcaj_2006(kamion); | |
break; | |
case 3: | |
rekurzija(kamion); | |
break; | |
} | |
}while(izbor!=9); | |
system("pause"); | |
return 0; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
#include <cstring> | |
using namespace std; | |
struct st{ | |
int serial; | |
string proizvodjac; | |
string model; | |
int god; | |
struct st *sljedeci; | |
}; | |
typedef struct st stack; | |
void InitS(stack *S){//inicijaliziranje glave | |
S->sljedeci=NULL; | |
} | |
void TopS(stack &s,string *proizvodjac, string *model, int *serial, int *god){ | |
stack *trenutni=s.sljedeci; | |
*proizvodjac =trenutni->proizvodjac; | |
*model=trenutni->model; | |
*serial=trenutni->serial; | |
*god=trenutni->god; | |
return; | |
} | |
void PushS(int serial, string proizvodjac, string model, int godiste,stack *S){ | |
stack *novi=new stack; | |
novi->sljedeci= S->sljedeci; | |
S->sljedeci=novi; | |
novi->proizvodjac=proizvodjac; | |
novi->model=model; | |
novi->god=godiste; | |
novi->serial=serial; | |
} | |
void PopS(stack *S){ | |
stack *brisi=S->sljedeci; | |
S->sljedeci=brisi->sljedeci; | |
delete brisi; | |
} | |
bool IsEmptyS(stack *S){ | |
if(S->sljedeci==NULL) | |
return true; | |
else | |
return false; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
#include <cstring> | |
using namespace std; | |
struct st{ | |
int god[10000]; | |
int serial[10000]; | |
string proizvodjac[10000]; | |
string model[10000]; | |
int vrh; | |
}; | |
typedef struct st stack; | |
void InitS(stack *s){ | |
s->vrh=9999; | |
} | |
void TopS(stack &s,string *proizvodjac, string *model, int *serial, int *god){ | |
*proizvodjac=s.proizvodjac[s.vrh+1]; | |
*model=s.model[s.vrh+1]; | |
*serial=s.serial[s.vrh+1]; | |
*god=s.god[s.vrh+1]; | |
return; | |
} | |
void PushS(int serial, string proizvodjac, string model, int god,stack *s){ | |
int broj; | |
broj=s->vrh; | |
s->serial[broj]=serial; | |
s->god[broj]=god; | |
s->model[broj]=model; | |
s->proizvodjac[broj]=proizvodjac; | |
s->vrh=broj-1; | |
} | |
void PopS(stack *stog){ | |
stog->vrh+=1; | |
} | |
bool IsEmptyS(stack *stog){ | |
if (stog->vrh==9999) | |
return true; | |
else | |
return false; | |
} |
sorry ,it's about what ?
why not derictly make "#include", and then make use of "try blocks and exception handling"?
Also include the following statement: "I swear, under penalty of perjury, that the information in this notification is accurate and that I am the copyright owner, or am authorized to act on behalf of the owner, of
hello world
hello world
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
program for what?