Advertisement
Guest User

mamkelivardasa

a guest
Feb 15th, 2019
100
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 4.07 KB | None | 0 0
  1. #include <iostream>
  2. #include <string>
  3. //#include "factorial.h"
  4. #include <ctime>
  5. #include <Windows.h>
  6.  
  7. using namespace std;
  8. const int NotUsed = system("color 0");
  9.  
  10.  
  11.  int Foo(int N)
  12. {
  13. if (N == 0)
  14. return 0;
  15. if (N == 1)
  16. return 1;
  17. return N * Foo(N - 1);
  18. }
  19.  
  20.  
  21. void sel(int select)
  22. {
  23.     switch (select)
  24.         {
  25.         case 1:
  26.  
  27.  
  28.             cout << "Нет." << endl;
  29.             system("pause");
  30.             break;
  31.         case 2:
  32.         {
  33.             int N;
  34.             cout << "Число факториала: " << endl;
  35.             cin >> N;
  36.             cout << "Фактариал числа: " << N << "равен = " << Foo(N) << endl;
  37.  
  38.             break;
  39.         }
  40.         case 3:
  41.  
  42.         {
  43.             {
  44.                 while (true) {
  45.                     srand(time(NULL));
  46.                     int pass;
  47.                     const int NotUsed = system("color 0");
  48.                     cout << "Приветствую тебя, Админ, напиши пароль, псс, пароль — 1 :)" << endl;
  49.                     cin >> pass;
  50.                     if (pass == 1)
  51.                     {
  52.                         cout << "Успешно)" << endl
  53.                             << "Что делаем?:" << endl
  54.                             << "1. Играем в кости, конечно же)" << endl;
  55.  
  56.  
  57.                         int brosok;
  58.                         cout << "Играем в кости" << endl;
  59.                         {
  60.                             int a = rand() % 6 + 1;
  61.                             int b = rand() % 6 + 1;
  62.                             cout << "Я бросила 1 кость: " << a << " )))) " << endl;
  63.  
  64.                             cout << "Теперь твой ход, введи 1 для броска)" << endl;
  65.                             cin >> brosok;
  66.                             if (brosok == 1)
  67.                             {
  68.  
  69.                                 cout << "Ты бросил кость: " << b << endl;
  70.  
  71.                                 if (a > b)
  72.  
  73.                                     cout << "Победила программа" << endl;
  74.  
  75.                                 if (a < b)
  76.                                 {
  77.                                     cout << "Победил Админ" << endl;
  78.                                 }
  79.                                 cout << "Для выход напиши - leave" << endl;
  80.                                 string exit;
  81.                                 cin >> exit;
  82.                                 if (exit == "leave")
  83.                                     return;
  84.  
  85.                                 if (a == b)
  86.  
  87.                                     cout << "ничья" << endl;
  88.  
  89.                             }
  90.  
  91.                         }
  92.                     }
  93.                     else
  94.                     {
  95.                         cout << "error" << endl;
  96.                     }
  97.                 }
  98.  
  99.             }
  100.  
  101.         }
  102.     }
  103. }
  104.  
  105. bool login100500TopSecret()
  106. {
  107.     int password;
  108.         int login;
  109.         cout << "Password?: " << endl;
  110.         cin >> password;
  111.  
  112.         if (password != 1)
  113.             return false;
  114.         cout << "Login?:" << endl;
  115.         cin >> login;
  116.         if (login != 1); // ливардас что ета ааааа
  117.  
  118.         return true;
  119. }
  120.  
  121. string menu4(char cyc)
  122. {
  123.     if(cyc == 'Y') return "Выйти";
  124.     else return "Зациклить программу.";
  125. }
  126.  
  127. int main()
  128. {
  129.     setlocale(LC_ALL, "ru");
  130.         if(!login100500TopSecret())
  131.             return 0;
  132.  
  133.  
  134.     char cyc = 'N';
  135.     int select = 0;
  136.     do{
  137.  
  138.         cout << "Привет, что хочешь сделать?" << endl
  139.             << "1. 1" << endl
  140.             << "2. 2." << endl
  141.             << "3. 3" << endl
  142.             << "4." << menu4(cyc) << endl; // v processe
  143.  
  144.         cin >> select;
  145.  
  146.         if(select == 4 && cyc == 'N') cyc = 'Y';
  147.         else if(select == 4 && cyc == 'Y') cyc = 'N';
  148.         else sel(select);
  149.  
  150.         cout << select << " " << cyc << endl;
  151.     }while(cyc == 'Y');
  152.     return 0;
  153. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement