Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- * ----------------------------------------------------------------------------
- * "THE BEER-WARE LICENSE" (Revision 42):
- * <[email protected]> wrote this file. As long as you retain this notice you
- * can do whatever you want with this stuff. If we meet some day, and you think
- * this stuff is worth it, you can buy me a beer in return
- * ----------------------------------------------------------------------------
- */
- #include <iostream>
- #include <cstdlib>
- #include <ctime>
- #include <cstring>
- //#include "stog_polje.h"
- #include "stog_pokazivac.h"
- using namespace std;
- void utovarRobe();
- void istovar1();
- int main() {
- InitS(stog);
- int izbor;
- do{
- cout<<"1. Utovar robe"<<endl;
- cout<<"2. Istovar robe"<<endl;
- cout<<"3. Istovar robe sa vrijednosti > 5000 i starosti > 3 mjeseca"<<endl;
- cout<<"9. Izlaz iz programa"<<endl;
- cout<<"?"<<endl;
- cin>>izbor;
- switch(izbor){
- case 1:
- utovarRobe();
- break;
- case 2:
- break;
- case 3:
- break;
- default:
- if(izbor!=9)
- cout<<"Pogresan unos!"<<endl<<endl;
- }
- }while(izbor!=9);
- return 0;
- }
- void utovarRobe(){
- srand(time(NULL));
- tpodaci temp;
- int vrsta=rand()%5;
- int model=rand()%3;
- int boja=rand()%3;
- temp.datum.d=rand()%30+1;
- temp.datum.m=rand()%12+1;
- temp.datum.g=rand()%50+1963;
- temp.cijena=rand()%10000+100;
- switch(vrsta){
- case 0:
- strcpy(temp.vrsta,"Smartphone");
- temp.sifra.append("Smp");
- break;
- case 1:
- strcpy(temp.vrsta,"Zvucnici");
- temp.sifra.append("Zvc");
- break;
- case 2:
- strcpy(temp.vrsta,"Mis");
- temp.sifra.append("Mis");
- break;
- case 3:
- strcpy(temp.vrsta,"Monitor");
- temp.sifra.append("Mtr");
- break;
- case 4:
- strcpy(temp.vrsta,"Tipkovnica");
- temp.sifra.append("Tpk");
- break;
- }
- switch(model){
- case 0:
- strcpy(temp.model,"LG");
- temp.sifra.append("LG");
- break;
- case 1:
- strcpy(temp.model,"Sony");
- temp.sifra.append("Sny");
- break;
- case 2:
- strcpy(temp.model,"Samsung");
- temp.sifra.append("Smg");
- break;
- }
- switch(boja){
- case 0:
- strcpy(temp.boja,"White");
- temp.sifra.append("Wht");
- break;
- case 1:
- strcpy(temp.boja,"Blue");
- temp.sifra.append("Blu");
- break;
- case 2:
- strcpy(temp.boja,"Green");
- temp.sifra.append("Grn");
- break;
- }
- PushS(temp, stog);
- }
- void istovar1(){
- }
Advertisement
Add Comment
Please, Sign In to add comment