From 96f8e9774ab6795ea7945b438f149d1e7e8af4b9 Mon Sep 17 00:00:00 2001 From: "loc@loc.loc" Date: Sat, 23 Nov 2024 10:51:20 +0400 Subject: [PATCH] =?UTF-8?q?=D0=94=D0=BE=D0=B1=D0=B0=D0=B2=D1=8C=D1=82?= =?UTF-8?q?=D0=B5=20=D1=84=D0=B0=D0=B9=D0=BB=D1=8B=20=D0=BF=D1=80=D0=BE?= =?UTF-8?q?=D0=B5=D0=BA=D1=82=D0=B0.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ConsoleApp1.sln | 25 +++++++++++++++++++++++++ ConsoleApp1/ConsoleApp1.csproj | 10 ++++++++++ ConsoleApp1/Program.cs | 34 ++++++++++++++++++++++++++++++++++ 3 files changed, 69 insertions(+) create mode 100644 ConsoleApp1.sln create mode 100644 ConsoleApp1/ConsoleApp1.csproj create mode 100644 ConsoleApp1/Program.cs diff --git a/ConsoleApp1.sln b/ConsoleApp1.sln new file mode 100644 index 0000000..3d0c0e0 --- /dev/null +++ b/ConsoleApp1.sln @@ -0,0 +1,25 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 17 +VisualStudioVersion = 17.8.34511.84 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ConsoleApp1", "ConsoleApp1\ConsoleApp1.csproj", "{6214036E-C64E-4150-8728-8681AA2E07AF}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {6214036E-C64E-4150-8728-8681AA2E07AF}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {6214036E-C64E-4150-8728-8681AA2E07AF}.Debug|Any CPU.Build.0 = Debug|Any CPU + {6214036E-C64E-4150-8728-8681AA2E07AF}.Release|Any CPU.ActiveCfg = Release|Any CPU + {6214036E-C64E-4150-8728-8681AA2E07AF}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {792CA066-4535-4CD5-9608-1EE77D2C6DEB} + EndGlobalSection +EndGlobal diff --git a/ConsoleApp1/ConsoleApp1.csproj b/ConsoleApp1/ConsoleApp1.csproj new file mode 100644 index 0000000..2150e37 --- /dev/null +++ b/ConsoleApp1/ConsoleApp1.csproj @@ -0,0 +1,10 @@ + + + + Exe + net8.0 + enable + enable + + + diff --git a/ConsoleApp1/Program.cs b/ConsoleApp1/Program.cs new file mode 100644 index 0000000..2d76bb6 --- /dev/null +++ b/ConsoleApp1/Program.cs @@ -0,0 +1,34 @@ +namespace ConsoleApp1 +{ + internal class Program + { + + static void Main(string[] args) + { + Random random = new Random(); + int value = random.Next(1, 10); + int user = Convert.ToInt32(Console.ReadLine()); + int count = 1; + while (user != value) { + count++; + if (count == 6) { + Console.WriteLine("Вы не угадали. У вас закончились попытки"); + break; + } + if (user > value) + { + Console.WriteLine("Число меньше"); + } + else + { + Console.WriteLine("Число больше"); + } + user = Convert.ToInt32(Console.ReadLine()); + } + if (count < 6) + { + Console.WriteLine("Вы угадали за " + count.ToString() + " попыток"); + } + } + } +}