This commit is contained in:
328p
2026-10-07 14:18:44 +03:00
parent 12711c5f9d
commit cc04f6e5a7
3 changed files with 86 additions and 0 deletions
+16
View File
@@ -0,0 +1,16 @@
Microsoft Visual Studio Solution File, Format Version 12.00
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ConsoleApp1", "ConsoleApp1\ConsoleApp1.csproj", "{D959845F-02D5-4C96-9BED-432306BA3585}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{D959845F-02D5-4C96-9BED-432306BA3585}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{D959845F-02D5-4C96-9BED-432306BA3585}.Debug|Any CPU.Build.0 = Debug|Any CPU
{D959845F-02D5-4C96-9BED-432306BA3585}.Release|Any CPU.ActiveCfg = Release|Any CPU
{D959845F-02D5-4C96-9BED-432306BA3585}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
EndGlobal
@@ -0,0 +1,10 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net10.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>
</Project>
@@ -0,0 +1,60 @@
using System;
namespace LabWork5
{
class Program
{
static void Main(string[] args)
{
// ЗАДАНИЕ 1
Console.WriteLine("=== ПОКЕЦЕНТР: ЛЕЧЕНИЕ ===");
int pokemonHP = 20;
Console.WriteLine($"Здоровье до лечения: {pokemonHP} HP.");
HealPokemon(ref pokemonHP);
Console.WriteLine($"Здоровье после лечения: {pokemonHP} HP.");
Console.WriteLine();
// ЗАДАНИЕ 2
Console.WriteLine("=== ИССЛЕДОВАНИЕ ЛОКАЦИИ ===");
Console.WriteLine("Вы зашли в высокую траву...");
SearchBushes(out string foundPokemon, out int pokemonLevel);
Console.WriteLine($"Шорох! Из кустов появляется дикий {foundPokemon} (Уровень: {pokemonLevel})!");
Console.WriteLine();
// ЗАДАНИЕ 3
Console.WriteLine("=== РЕГИСТРАЦИЯ НА ТУРНИР ===");
double difficulty = 1.5;
RegisterTournament(in difficulty, "Булбазавр", "Чармандер");
RegisterTournament(in difficulty, "Сквиртл", "Пикачу", "Псайдак", "Мяут");
Console.WriteLine("=============================");
}
// Задание 1
static void HealPokemon(ref int hp)
{
int healed = 100 - hp;
hp = 100;
Console.WriteLine($"[Покецентр] Покемон полностью здоров! Восстановлено {healed} HP.");
}
// Задание 2
static void SearchBushes(out string foundPokemon, out int pokemonLevel)
{
Random rnd = new Random();
foundPokemon = "Пикачу";
pokemonLevel = rnd.Next(1, 16);
}
// Задание 3
static void RegisterTournament(in double difficulty, params string[] participants)
{
Console.WriteLine($"Коэффициент стадиона: {difficulty}");
Console.WriteLine("Список участников:");
foreach (string p in participants)
{
Console.WriteLine($" * {p}");
}
Console.WriteLine("-----------------------------");
}
}
}