Glenpl

Untitled

Sep 13th, 2014
409
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 6.79 KB | None | 0 0
  1. #include <iostream>
  2. #include <windows.h>
  3. #include <cstdlib>
  4. #include <string>
  5. #include <ctime>
  6. #include <stdio.h>
  7. #include <conio.h>
  8.  
  9. using namespace std;
  10.  
  11. int main()
  12. {
  13.     srand( time( NULL ) );
  14.     HANDLE kolor;
  15.     kolor = GetStdHandle( STD_OUTPUT_HANDLE );
  16.     string imie;
  17.     string nazwisko;
  18.     int oC=1;
  19.     int oR=1;
  20.     int oW=1;
  21.     int oH=1;
  22.     int fundusze;
  23.     int cebula;
  24.     int dzien=1;
  25.     int gielda = 1;
  26.     int wynik;
  27.     int wybor;
  28.     int logowanie;
  29.     int a;
  30.     int user;
  31.  
  32.     do
  33.     {
  34.         system ("CLS");
  35.         cout <<"1. Nowy uzytkownik \n";
  36.         cout <<"2. Bylem tu juz. \n";
  37.         cin >> user;
  38.         system ("CLS");
  39.         if(user==1)
  40.         {
  41.             cout << "Podaj Imie \n";
  42.             cin >> imie;
  43.             Sleep(300);
  44.             cout << "Podaj Nazwisko \n";
  45.             cin >> nazwisko ;
  46.             Sleep(300);
  47.             cout << "Wybierz kolor napisow (od 1-15) ";
  48.             cin >> a;
  49.             logowanie=0;
  50.             fundusze=500;
  51.             cebula=0;
  52.         }
  53.  
  54.         if(user==2)
  55.         {
  56.             cout << "Witamy Pownownie"<< imie<<nazwisko;
  57.             Sleep(500);
  58.             logowanie=0;
  59.         }
  60.  
  61.         if(user>2)
  62.         {
  63.             cout << "Wystapil blad, wysylamy do pana grupe naszych najlepszych malp. \n Prosze nie wylaczac komputera i siedziec spokojnie na swoim miejscu";
  64.             -getch();
  65.             logowanie=1;
  66.         }
  67.     }
  68.     while(logowanie==1);
  69.     int ujemnik((rand() % 40) +1);
  70.     int polska = ((rand() % 150 ) + 50);
  71.     int polska_s = ((rand() % 200 ) +30);
  72.     polska_s=polska-ujemnik;
  73.  
  74.     int rosja = rand();
  75.     int rosja_s = rand();
  76.     rosja>rosja_s;
  77.     int niemcy= rand();
  78.     int niemcy_s = rand();
  79.     int ameryka = rand();
  80.     int ameryka_s = rand();
  81.  
  82.     do
  83.     {
  84.         system ("CLS");
  85.         SetConsoleTextAttribute(kolor, a);
  86.  
  87.         cout << "Zalogowano \n";
  88.         cout << "\n Inwestor " << imie;
  89.         cout << " " << nazwisko << "\n";
  90.         SetConsoleTextAttribute( kolor, 14);
  91.         cout << "                                      dostepne fundusze : "<< fundusze <<"\n" ;
  92.         SetConsoleTextAttribute( kolor, 14);
  93.         cout << "                                       ilosc ton cebuli : "<<cebula<<"\n";
  94.         cout << "                                                  Dzien : "<<dzien<<"\n";
  95.         SetConsoleTextAttribute( kolor, a);
  96.         cout << " Wyswietlam gielde cebul: \n";
  97.         SetConsoleTextAttribute( kolor, a);
  98.         cout << "1. Cebulandia \n";
  99.         SetConsoleTextAttribute( kolor, a );
  100.         cout << "2. Mateczka Rosja \n";
  101.         SetConsoleTextAttribute( kolor, a);
  102.         cout << "3. Stolica Wermacht'u \n";
  103.         SetConsoleTextAttribute(kolor, a );
  104.         cout << "4. Hamburgerandia \n";
  105.         SetConsoleTextAttribute(kolor, a);
  106.         cout <<"5. Nastepny dzien (zmiana cen) \n";
  107.         SetConsoleTextAttribute(kolor, a);
  108.         cout <<"6. Wyjscie \n";
  109.         SetConsoleTextAttribute(kolor, 15  );
  110.         cout << "Wybierz swoja gielde (wpisz numer) ";
  111.         cin >> wybor ;
  112.         if(wybor==1)
  113.         {
  114.             system("CLS");
  115.             int poland;
  116.             int zakup;
  117.             int tal; //zgoda na zakup
  118.             SetConsoleTextAttribute(kolor, a);
  119.             cout <<"                  Cebulandia          \n";
  120.             cout<<"1. KUPNO: 1 tona cebuli / "<< polska <<" zloty \n2. SPRZEDAZ: 1 tona cebuli / "<<polska_s<<" zloty \n3. Wyjscie z gieldy 'Cebulandia'\n";
  121.             cin>> tal;
  122.             if(tal==1)
  123.             {
  124.                 cout << "1.Kup kilka cebul \n";
  125.                 cout << "2.Kup maksymalna mozliwa ilosc \n";
  126.                 cout << "Wybierz  ";
  127.                 cin >> zakup ;
  128.  
  129.                 if(zakup==1)
  130.                 {
  131.                     cout << "Ile cebul chce pan kupic? \n";
  132.                     cin >> poland ;
  133.                     poland=polska*poland ;
  134.                     if(fundusze>=poland)
  135.                     {
  136.                         cout << "Kosztowalo : "<< poland <<"\n";
  137.                         fundusze=fundusze-poland;
  138.                         cout <<"Pozostalo "<< fundusze ;
  139.                         oC=0;
  140.                         _getch();
  141.                         cebula=cebula+poland/polska;
  142.  
  143.                     }
  144.                     else //(fundusze<poland)
  145.                     {
  146.                         cout<<"Nie masz tyle pieniedzy, biedaku \n";
  147.                         cout<<"Wracam do gieldy";
  148.                         _getch();
  149.                     }
  150.                 }
  151.                 if(zakup==2)
  152.                 {
  153.                     int cebk;
  154.                     int kp = 1;
  155.                     cebk=fundusze/polska;
  156.                     cout<<"Mozesz kupic "<< cebk <<" Cebul \n";
  157.                     cout<<"Kupic? (1.tak | 2.nie) ";
  158.                     cin>>kp;
  159.  
  160.                     if(kp==1)
  161.                     {
  162.                         cebula=cebula+cebk;
  163.  
  164.                         cout<<"Kosztowało "<< cebk*polska <<"\n""Kupil pan "<<cebk<<"\n""Kupiono ma pan teraz "<< cebula;
  165.                         fundusze=fundusze-cebk*polska;
  166.                         oC=0;
  167.                         _getch();
  168.                     }
  169.                     if(kp==2)
  170.                     {
  171.                         cout<<"Nie to nie";
  172.                         oC=0;
  173.                         _getch();
  174.                     }
  175.                     if(kp>=3)
  176.                     {
  177.                         system("CLS");
  178.                         cout<<"Nie ma takiej opcji, przyrko mi";
  179.                         _getch();
  180.                         oC=0;
  181.                     }
  182.                 }
  183.  
  184.                 if(tal>=3)
  185.                 {
  186.                     system("CLS");
  187.                     cout<<"Nie ma takiej opcji, przyrko mi";
  188.                     _getch();
  189.                     oC=0;
  190.                 }
  191.             }
  192.         }
  193.  
  194.         if(wybor==5 )
  195.         {
  196.             system("CLS");
  197.             int ujemnik((rand() % 40) +1);
  198.             int polska = ((rand() % 150 ) + 50);
  199.             int polska_s = ((rand() % 200 ) +50);
  200.  
  201.  
  202.             int rosja = rand();
  203.             int rosja_s = rand();
  204.             rosja>rosja_s;
  205.  
  206.             int niemcy= rand();
  207.             int niemcy_s = rand();
  208.  
  209.             int ameryka = rand();
  210.             int ameryka_s = rand();
  211.             dzien=dzien+1;
  212.             cout<<"Minela noc. Jest dzien "<<dzien;
  213.             Sleep(700);
  214.  
  215.         }
  216.         if(wybor==6)
  217.         {
  218.             cout<<"Dziekuje";
  219.             gielda==0;
  220.             Sleep(400);
  221.  
  222.         }
  223.         if(wybor>=7)
  224.         {
  225.             cout<<"Nie ma takej opcji";
  226.             _getch();
  227.         }
  228.         system("CLS");
  229.     }
  230.     while(gielda==1);
  231.     return 0;
  232. }
Advertisement
Add Comment
Please, Sign In to add comment