B3ar6

Village develop (GAME)

May 4th, 2017
102
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 2.86 KB | None | 0 0
  1. #include<iostream>
  2. using namespace std;
  3.  
  4. int main()
  5. {
  6.     int domek=1, miesz=2, pod=3, wy, zl=1000, d=0, m=0;
  7.     cout << "Witaj w mini grze !" << endl;
  8.     cout << "Masz za zadanie rozwinac swoja wioske." << endl;
  9.  
  10.     do
  11.     {
  12.     cout << "Zloto : " << zl << " domki : " << d << " mieszkancy : " << m << endl;
  13.     cout << "1 = wybuduj domek" << endl;
  14.     cout << "2 = kup mieszkancow" << endl;
  15.     cout << "3 = zbierz podatek" << endl;
  16.     cout << "4 = wyjscie" << endl;
  17.     cout << endl;
  18.     cout << "twoj wybor : ";
  19.     cin >> wy;
  20.  
  21.     switch(wy)
  22.     {
  23.         case 1:
  24.             if(zl>=100)
  25.             {
  26.                 zl=zl-100;
  27.                 d++;
  28.             }
  29.             else
  30.             {
  31.                 cout << "nie masz pieniedzy!" << endl;
  32.                     if(m>0)
  33.                     {
  34.                         cout << "pobierz podatek jezeli chcesz grac dalej!" << endl;
  35.                         cout << "szansa : ";
  36.                         cin >> wy;
  37.                             if(wy!=3)
  38.                             {
  39.                                 cout << "nie pobrales podatku!" << endl;
  40.                                 cout << "jestes bankrutem!" << endl;
  41.                                 exit(0);
  42.                             }
  43.                     }
  44.             }
  45.         break;
  46.  
  47.         case 2:
  48.             if(zl<150 && m<1)
  49.             {
  50.                 cout << "nie masz mieszkancow od ktorych pobralbys podatek!" << endl;
  51.                 exit(0);
  52.             }
  53.             if(d<1)
  54.                 {
  55.                 cout << "mieszkancy nie maja gdzie mieszkac, wybuduj im dom!" << endl;
  56.                 system("pause");
  57.                 }
  58.             else
  59.             {
  60.                 if(zl>=150)
  61.                 {
  62.                     zl=zl-150;
  63.                     m++;
  64.                 }
  65.                 else
  66.                 {
  67.                     cout << "nie masz pieniedzy!" << endl;
  68.                         if(m>0)
  69.                         {
  70.                             cout << "pobierz podatek jezeli chcesz grac dalej!" << endl;
  71.                             cout << "szansa : ";
  72.                             cin >> wy;
  73.                                 if(wy!=3)
  74.                                 {
  75.                                     cout << "nie pobrales podatku!" << endl;
  76.                                     cout << "jestes bankrutem!" << endl;
  77.                                     exit(0);
  78.                                 }
  79.                         }
  80.                 }
  81.             }
  82.         break;
  83.  
  84.         case 3:
  85.             zl=zl+m*10;
  86.         break;
  87.  
  88.         case 4:
  89.             exit(0);
  90.         break;
  91.  
  92.         default:
  93.             cout << "podales nie poprawna opcje!" << endl;
  94.         break;
  95.     }
  96.     cout << endl;
  97.     system("cls");
  98.     }while(wy=4);
  99.  
  100.     system("pause");
  101.     return 0;
  102. }
Add Comment
Please, Sign In to add comment