SHARE
TWEET

Untitled

a guest Mar 24th, 2019 48 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include <time.h>
  2. #include <iostream>
  3. #include <conio.h>
  4. #include<windows.h>
  5. using namespace std;
  6.  
  7. void show(int x)
  8. {
  9.     switch (x)
  10.     {
  11.     case 1:
  12.         cout << "    " << (char)218 << (char)196 << (char)196 << (char)196 << (char)191 << endl
  13.              << "    " << (char)179 << "    " << "    " <<  "    "  << (char)179 << endl
  14.              << "    " << (char)179 << "    " << (char)42 << "    " << (char)179 << endl
  15.              << "    " << (char)179 << "    " << "    " << "    " << (char)179 << endl
  16.              << "    " << (char)192 << (char)196 << (char)196 << (char)196 << (char)217 << endl;
  17.              cout << endl;
  18.         break;
  19.  
  20.     case 2:
  21.         cout << "    " << (char)218 << (char)196 << (char)196 << (char)196 << (char)191 << endl
  22.             << "    " << (char)179 << "    " << "    " << (char)42 << (char)179 << endl
  23.             << "    " << (char)179 << "    " <<  "    "  << "    " << (char)179 << endl
  24.             << "    " << (char)179 << (char)42 << "    " << "    " << (char)179 << endl
  25.             << "    " << (char)192 << (char)196 << (char)196 << (char)196 << (char)217 << endl;
  26.         cout << endl;
  27.         break;
  28.  
  29.     case 3:
  30.         cout << "    " << (char)218 << (char)196 << (char)196 << (char)196 << (char)191 << endl
  31.             << "    " << (char)179 << "    " << "    " << (char)42 << (char)179 << endl
  32.             << "    " << (char)179 << "    " << (char)42 << "    " << (char)179 << endl
  33.             << "    " << (char)179 << (char)42 << "    " << "    " << (char)179 << endl
  34.             << "    " << (char)192 << (char)196 << (char)196 << (char)196 << (char)217 << endl;
  35.         cout << endl;
  36.         break;
  37.  
  38.     case 4:
  39.         cout << "    " << (char)218 << (char)196 << (char)196 << (char)196 << (char)191 << endl
  40.             << "    " << (char)179 << (char)42 << "    " << (char)42 << (char)179 << endl
  41.             << "    " << (char)179 << "    " <<  "    "  << "    " << (char)179 << endl
  42.             << "    " << (char)179 << (char)42 << "    " << (char)42 << (char)179 << endl
  43.             << "    " << (char)192 << (char)196 << (char)196 << (char)196 << (char)217 << endl;
  44.         cout << endl;
  45.         break;
  46.  
  47.     case 5:
  48.         cout << "    " << (char)218 << (char)196 << (char)196 << (char)196 << (char)191 << endl
  49.             << "    " << (char)179 << (char)42 << "    " << (char)42 << (char)179 << endl
  50.             << "    " << (char)179 << "    " << (char)42 << "    " << (char)179 << endl
  51.             << "    " << (char)179 << (char)42 << "    " << (char)42 << (char)179 << endl
  52.             << "    " << (char)192 << (char)196 << (char)196 << (char)196 << (char)217 << endl;
  53.         cout << endl;
  54.         break;
  55.  
  56.     case 6:
  57.         cout << "    " << (char)218 << (char)196 << (char)196 << (char)196 << (char)191 << endl
  58.             << "    " << (char)179 << (char)42 << "    " << (char)42 << (char)179 << endl
  59.             << "    " << (char)179 << (char)42 <<  "    " << (char)42 << (char)179 << endl
  60.             << "    " << (char)179 << (char)42 << "    " << (char)42 << (char)179 << endl
  61.             << "    " << (char)192 << (char)196 << (char)196 << (char)196 << (char)217 << endl;
  62.         cout << endl;
  63.         break;
  64.     }
  65. }
  66.  
  67. int main()
  68. {
  69.     setlocale(LC_ALL, "Russian");
  70.     cout << "Добро пожаловать в игру!" << endl;
  71.     cout << "Правила таковы: Выигрывает тот у кого больше очков. Удачи в игре!" << endl;
  72.     cout << endl;
  73.     srand(time(0));
  74.     int p, player1 = 0, player2 = 0, a, b;
  75.     do
  76.     {
  77.         cout << "Нажмите [1] для броска, [2] - для просмотра счета, [3] - для выхода из игры. ";
  78.         cin >> p;
  79.         switch (p)
  80.         {
  81.         case 1:
  82.             system("cls");
  83.             a = rand() % 6 + 1;
  84.             b = rand() % 6 + 1;
  85.             cout << "У Вас: " << endl;
  86.             show(a);
  87.             player1 += a;
  88.             cout << "У компьютера: " << endl;
  89.             show(b);
  90.             player2 += b;
  91.             break;
  92.         case 2:
  93.             if (player1 > player2)
  94.                 cout << "Вы выигрываете со счетом: " << player1 << ":" << player2 << endl;
  95.             cout << endl;
  96.             if (player2 > player1)
  97.                 cout << "Вы проигрываете со счетом: " << player2 << ":" << player1 << endl;
  98.             cout << endl;
  99.             if (player1 == player2)
  100.                 cout << "Счет равный! " << player1 << ":" << player2 << endl;
  101.             cout << endl;
  102.             break;
  103.         }
  104.     } while (p != 3);
  105.     _getch();
  106. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top