tehlurk

Main

Nov 24th, 2013
28
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 2.37 KB | None | 0 0
  1. /*
  2.  * ----------------------------------------------------------------------------
  3.  * "THE BEER-WARE LICENSE" (Revision 42):
  4.  * <[email protected]> wrote this file. As long as you retain this notice you
  5.  * can do whatever you want with this stuff. If we meet some day, and you think
  6.  * this stuff is worth it, you can buy me a beer in return
  7.  * ----------------------------------------------------------------------------
  8.  */
  9.  
  10. #include <iostream>
  11. #include <cstdlib>
  12. #include <ctime>
  13. #include <cstring>
  14. //#include "stog_polje.h"
  15. #include "stog_pokazivac.h"
  16. using namespace std;
  17.  
  18. void utovarRobe();
  19. void istovar1();
  20.  
  21. int main() {
  22.    
  23.     InitS(stog);
  24.     int izbor;
  25.    
  26.     do{
  27.         cout<<"1. Utovar robe"<<endl;
  28.         cout<<"2. Istovar robe"<<endl;
  29.         cout<<"3. Istovar robe sa vrijednosti > 5000 i starosti > 3 mjeseca"<<endl;
  30.         cout<<"9. Izlaz iz programa"<<endl;
  31.         cout<<"?"<<endl;
  32.         cin>>izbor;
  33.        
  34.         switch(izbor){
  35.             case 1:
  36.                 utovarRobe();
  37.                 break;
  38.             case 2:
  39.                 break;
  40.             case 3:
  41.                 break;
  42.             default:
  43.                 if(izbor!=9)
  44.                     cout<<"Pogresan unos!"<<endl<<endl;
  45.         }
  46.        
  47.     }while(izbor!=9);
  48.    
  49.     return 0;
  50. }
  51.  
  52. void utovarRobe(){
  53.     srand(time(NULL));
  54.     tpodaci temp;  
  55.     int vrsta=rand()%5;
  56.     int model=rand()%3;
  57.     int boja=rand()%3;
  58.     temp.datum.d=rand()%30+1;
  59.     temp.datum.m=rand()%12+1;
  60.     temp.datum.g=rand()%50+1963;
  61.     temp.cijena=rand()%10000+100;
  62.    
  63.     switch(vrsta){
  64.         case 0:
  65.             strcpy(temp.vrsta,"Smartphone");
  66.             temp.sifra.append("Smp");
  67.             break;
  68.         case 1:
  69.             strcpy(temp.vrsta,"Zvucnici");
  70.             temp.sifra.append("Zvc");
  71.             break;
  72.         case 2:
  73.             strcpy(temp.vrsta,"Mis");
  74.             temp.sifra.append("Mis");
  75.             break;
  76.         case 3:
  77.             strcpy(temp.vrsta,"Monitor");
  78.             temp.sifra.append("Mtr");
  79.             break;
  80.         case 4:
  81.             strcpy(temp.vrsta,"Tipkovnica");
  82.             temp.sifra.append("Tpk");
  83.             break;
  84.     }
  85.     switch(model){
  86.         case 0:
  87.             strcpy(temp.model,"LG");
  88.             temp.sifra.append("LG");
  89.             break;
  90.         case 1:
  91.             strcpy(temp.model,"Sony");
  92.             temp.sifra.append("Sny");
  93.             break;
  94.         case 2:
  95.             strcpy(temp.model,"Samsung");
  96.             temp.sifra.append("Smg");
  97.             break;
  98.     }
  99.     switch(boja){
  100.         case 0:
  101.             strcpy(temp.boja,"White");
  102.             temp.sifra.append("Wht");
  103.             break;
  104.         case 1:
  105.             strcpy(temp.boja,"Blue");
  106.             temp.sifra.append("Blu");
  107.             break;
  108.         case 2:
  109.             strcpy(temp.boja,"Green");
  110.             temp.sifra.append("Grn");
  111.             break;
  112.     }
  113.     PushS(temp, stog);
  114. }
  115.  
  116. void istovar1(){
  117.    
  118. }
Advertisement
Add Comment
Please, Sign In to add comment