This commit is contained in:
2026-09-21 10:32:51 +03:00
parent fedaba45b2
commit 1edae99704
3 changed files with 70 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}") = "lab-05", "lab-05\lab-05.csproj", "{7FD82783-1125-4A16-9DA9-633C3F5D7B3C}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{7FD82783-1125-4A16-9DA9-633C3F5D7B3C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{7FD82783-1125-4A16-9DA9-633C3F5D7B3C}.Debug|Any CPU.Build.0 = Debug|Any CPU
{7FD82783-1125-4A16-9DA9-633C3F5D7B3C}.Release|Any CPU.ActiveCfg = Release|Any CPU
{7FD82783-1125-4A16-9DA9-633C3F5D7B3C}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
EndGlobal
+43
View File
@@ -0,0 +1,43 @@
Console.WriteLine("=== ЗАДАНИЕ 1. ===");
int pokemonHp = 20;
Console.WriteLine("=== ПОКЕЦЕНТР: ЛЕЧЕНИЕ ===");
Console.WriteLine($"Здоровье до лечения: {pokemonHp}.");
static void HealPokemon(ref int pokemonHp)
{
pokemonHp += 80;
Console.WriteLine("[Покецентр] Покемон полностью здоров! Восстановлено 80 HP.");
}
HealPokemon(ref pokemonHp);
Console.WriteLine($"Здоровье после лечения: {pokemonHp}.");
Console.WriteLine("\n=== ЗАДАНИЕ 2. ===");
Console.WriteLine("=== ИССЛЕДОВАНИЕ ЛОКАЦИИ ===");
Console.WriteLine($"Вы зашли в высокую траву...");
static void SearchBushes(out string foundPokemon, out int pokemonLevel)
{
foundPokemon = "Пикачу";
pokemonLevel = new Random().Next(1, 15);
}
SearchBushes(out string pokemonName, out int level);
Console.WriteLine($"Шорох! Из кустов появляется дикий {pokemonName}, (Уровень: {level})");
Console.WriteLine("\n=== ЗАДАНИЕ 3. ===");
static void RegisterTournament(in double difficulty, params string[] participants)
{
// difficulty = 2.0; // компилятор выдаст ошибку
Console.WriteLine($"Коэффициент стадиона: {difficulty}");
Console.WriteLine("Список участников:");
foreach (string pokemon in participants)
{
Console.WriteLine($"* {pokemon}");
}
}
Console.WriteLine("=== РЕГИСТРАЦИЯ НА ТУРНИР ===");
RegisterTournament(1.5, "Бульбазавр", "Чармандер");
Console.WriteLine("-----------------------------");
RegisterTournament(1.5, "Сквиртл", "Пикачу", "Псайдак", "Мяут");
Console.WriteLine("=============================");
+11
View File
@@ -0,0 +1,11 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net10.0</TargetFramework>
<RootNamespace>lab_05</RootNamespace>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>
</Project>