Advertisement
dimon-torchila

Untitled

Oct 3rd, 2021
157
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 2.00 KB | None | 0 0
  1. #include<iostream>
  2. #include<random>
  3. #include<Windows.h>
  4. using namespace std;
  5. void kubik(int points)
  6. {
  7.     switch (points)
  8.     {
  9.     case 1:
  10.         cout << "#-----#\n|     |\n|  *  |\n|     |\n#-----#" << endl;
  11.         break;
  12.     case 2:
  13.         cout << "#-----#\n| *   |\n|     |\n|   * |\n#-----#" << endl;
  14.         break;
  15.     case 3:
  16.         cout << "#-----#\n| *   |\n|  *  |\n|   * |\n#-----#" << endl;
  17.         break;
  18.     case 4:
  19.         cout << "#-----#\n| * * |\n|     |\n| * * |\n#-----#" << endl;
  20.         break;
  21.     case 5:
  22.         cout << "#-----#\n| * * |\n|  *  |\n| * * |\n#-----#" << endl;
  23.         break;
  24.     case 6:
  25.         cout << "#-----#\n| * * |\n| * * |\n| * * |\n#-----#" << endl;
  26.         break;
  27.         cout << endl;
  28.     }
  29. }
  30. int main()
  31. {
  32.     setlocale(LC_ALL, "rus");
  33.     srand(time(NULL));
  34.     cout << "Поиграешь со мной в кости?" << endl;
  35.     int mypoints = 0, pcpoints = 0;
  36.     bool k = rand() % 2;
  37.     if (k)
  38.     {
  39.         cout << "Ходи первым " << endl;
  40.     }
  41.     else
  42.     {
  43.         cout << "Я хожу первым " << endl;
  44.     }
  45.     int p;
  46.     for (int i = 0; i < 4; ++i)
  47.     {
  48.         for (int x = 0; x < 2; ++x)
  49.         {
  50.             if (k)
  51.             {
  52.                 p = rand() % 6 + 1;
  53.                 mypoints += p;
  54.                 cout << "Тебе выпало: " << p << endl;
  55.                
  56.             }
  57.             else
  58.             {
  59.                 p = rand() % 6 + 1;
  60.                 pcpoints += p;
  61.                 cout << "Мне выпало: " << p << endl;
  62.                
  63.             }
  64.              kubik(p);
  65.         }
  66.         if (i < 3)
  67.         {
  68.             if (mypoints > pcpoints)
  69.             {
  70.                 cout << "Пока ты лидируешь ";
  71.             }
  72.             else if (mypoints < pcpoints)
  73.             {
  74.                 cout << "Догоняй, друг ";
  75.             }
  76.             else if (mypoints < pcpoints)
  77.             {
  78.                 cout << "Пока что наравне ";
  79.             }
  80.             cout << mypoints << '-' << pcpoints << endl;
  81.         }
  82.         else
  83.         {
  84.             if (mypoints > pcpoints)
  85.             {
  86.                 cout << "Позравляю с выигрышем ";
  87.             }
  88.             else if (mypoints < pcpoints)
  89.             {
  90.                 cout << "Я тебя обыграл))) ";
  91.             }
  92.             else if (mypoints < pcpoints)
  93.             {
  94.                 cout << "Ничья, сойдёмся на этом";
  95.             }
  96.             cout << mypoints << '-' << pcpoints << endl;
  97.         }
  98.     }
  99. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement