Created
August 24, 2024 12:29
-
-
Save IvanEnginer/2dc3bb732f9a3d4fb957acc1d030e11b to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| using System; | |
| namespace HW_02 | |
| { | |
| internal class Program | |
| { | |
| static void Main(string[] args) | |
| { | |
| const string commandExit = "q"; | |
| bool isWork = true; | |
| bool isGuess; | |
| double probable = 0.5d; | |
| string choiceOfSide; | |
| string command; | |
| Random random = new Random(); | |
| double chance; | |
| while (isWork) | |
| { | |
| Console.WriteLine("Введите Орел или Решка"); | |
| choiceOfSide = Console.ReadLine().ToLower(); | |
| chance = random.NextDouble(); | |
| if (chance <= probable) | |
| isGuess = true; | |
| else | |
| isGuess = false; | |
| if (isGuess) | |
| Console.WriteLine("Поздравляю ты угадал"); | |
| else | |
| Console.WriteLine("Ты не угадал"); | |
| Console.WriteLine("Что бы закончить игру введи q"); | |
| command = Console.ReadLine(); | |
| if (command == commandExit) | |
| isWork = false; | |
| } | |
| } | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment