Advertisement
Guest User

Untitled

a guest
Apr 1st, 2020
110
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.55 KB | None | 0 0
  1. #include <windows.h>
  2. #include <iostream>
  3. #include <iomanip>
  4. #include <locale>
  5.  
  6. #include <string>
  7. #include <string.h>
  8.  
  9. #include <ctime>
  10. #include <cmath>>
  11.  
  12. using namespace std;
  13.  
  14. ////////////////////
  15.  
  16. struct BonesPlay
  17. {
  18. int fBones;
  19. int sBones;
  20.  
  21. int Ebons;
  22.  
  23. }fPlay, sPlay;
  24.  
  25. ////////////////////
  26.  
  27. int main()
  28. {
  29. setlocale(LC_CTYPE, "rus");
  30. SetConsoleOutputCP(1251);
  31. SetConsoleCP(1251);
  32.  
  33. string sss; int result; string a;
  34.  
  35. NEWGAME:
  36. srand (time(NULL));
  37.  
  38. cout<<"Первый игрок бросает кости нажатием клавиши [ENTER] "<<endl;
  39. cin.get();
  40.  
  41. fPlay.fBones= rand()%6+1; fPlay.sBones= rand()%6+1;
  42. fPlay.Ebons= fPlay.fBones + fPlay.sBones;
  43.  
  44. cout<<"Первая кость "<< fPlay.fBones<< endl;
  45. cout<<"Вторая кость "<< fPlay.sBones<< endl;
  46.  
  47. cout<<endl<<"Второй игрок бросает кости нажатием клавиши [ENTER] "<<endl;
  48. cin.get();
  49.  
  50. sPlay.fBones= rand()%6+1; sPlay.sBones= rand()%6+1;
  51. sPlay.Ebons= sPlay.fBones + sPlay.sBones;
  52.  
  53. cout<<"Первая кость "<< sPlay.fBones<< endl;
  54. cout<<"Вторая кость "<< sPlay.sBones<< endl;
  55.  
  56. result= fPlay.Ebons - sPlay.Ebons;
  57.  
  58. cout<<endl;
  59. sss= "Ничья...";
  60. if (result<0) sss= "Второй выиграл!";
  61. if(result>0) sss= "Победил Первый!";
  62.  
  63. cout<< sss<<endl;
  64.  
  65. cout<<"Продолжим ? [у] - ДА иначе стоп"; cin>>a;
  66. cout<<endl;
  67.  
  68. if (a=="y") goto NEWGAME;
  69.  
  70. system("pause");
  71. return 0;
  72. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement