Добавьте файлы проекта.

This commit is contained in:
loc@loc.loc 2024-11-23 10:51:20 +04:00
parent ad368f8ff8
commit 96f8e9774a
3 changed files with 69 additions and 0 deletions

25
ConsoleApp1.sln Normal file
View File

@ -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

View File

@ -0,0 +1,10 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net8.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>
</Project>

34
ConsoleApp1/Program.cs Normal file
View File

@ -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() + " попыток");
}
}
}
}