From 440d31767abfaf70e991802df76f960397b61d94 Mon Sep 17 00:00:00 2001 From: Lenya228Cherevko Date: Thu, 1 Oct 2026 08:02:00 +0000 Subject: [PATCH] =?UTF-8?q?=D0=97=D0=B0=D0=B3=D1=80=D1=83=D0=B7=D0=B8?= =?UTF-8?q?=D1=82=D1=8C=20=D1=84=D0=B0=D0=B9=D0=BB=D1=8B=20=D0=B2=20=C2=AB?= =?UTF-8?q?works=C2=BB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- works/Readme.md | 87 +++++++++++++++++++++++++++++++++++++++++++++++++ works/ex.1.cs | 21 ++++++++++++ works/ex.2.cs | 21 ++++++++++++ works/ex.3.cs | 31 ++++++++++++++++++ 4 files changed, 160 insertions(+) create mode 100644 works/Readme.md create mode 100644 works/ex.1.cs create mode 100644 works/ex.2.cs create mode 100644 works/ex.3.cs diff --git a/works/Readme.md b/works/Readme.md new file mode 100644 index 0000000..6c21ab8 --- /dev/null +++ b/works/Readme.md @@ -0,0 +1,87 @@ +# Лабораторная работа №4 + +* **Студент:** [Мастио Вячеслав Алексеевич] + +--- + +## Ключевой код +*Задание 1* +```csharp +public class ex_1 +{ + static void Main(string[] args) + { + Console.WriteLine("=== РЕГИСТРАЦИЯ КОМАНДЫ ==="); + string[] pokemonNames = new string[3]; + for (int i = 0; i < pokemonNames.Length; i++) + { + Console.Write($"Видите имя покемона №{i + 1}: "); + pokemonNames[i] = Console.ReadLine(); + } + Console.WriteLine(); + Console.WriteLine("--- Ваша команда на этот бой ---"); + Console.WriteLine($"1. {pokemonNames[0]}"); + Console.WriteLine($"2. {pokemonNames[1]}"); + Console.WriteLine($"1. {pokemonNames[0]}"); + + } +} +``` +--- +*Задание 2* +```csharp +namespace DefaultNamespace; +using System.Collections.Generic; +public class ex_2 +{ + static void Main() + { + List backpack = new List(); + backpack.Add("Зелья HP"); + backpack.Add("Покебол"); + backpack.Add("Антидот"); + + Console.WriteLine("Вы положили вещи в сумку. Предметов в инвентаре: " + backpack.Count); + + backpack.Remove("Покебол"); + Console.WriteLine("Вы использовали один Покебол для поимки дикого покемона!"); + + Console.WriteLine("Обновленный инвентарь. Осталось предметов: " + backpack.Count); + + + } +} +``` +--- +*Задание 3* +```csharp +public class ex_3 +{ + static void Main() + { + List backpack = new List(); + backpack.Add("Зелья HP"); + backpack.Add("Покебол"); + backpack.Add("Антидот"); + + Console.WriteLine("=== ИНВЕНТАРЬ ТРЕНЕРА ==="); + Console.WriteLine("Вы положили вещи в сумку. Предметов в инвентаре: " + backpack.Count); + + backpack.Remove("Покебол"); + Console.WriteLine("Вы использовали один Покебол для поимки дикого покемона!"); + + Console.WriteLine("Обновленный инвентарь. Осталось предметов: " + backpack.Count); + + Console.WriteLine(); + Console.WriteLine("--- Содержимое вашей сумки ---"); + foreach (string item in backpack) + { + Console.WriteLine($"[Предмет] -> {item}"); + + } + Console.WriteLine("============================="); + + + } +} +``` diff --git a/works/ex.1.cs b/works/ex.1.cs new file mode 100644 index 0000000..b3d3da2 --- /dev/null +++ b/works/ex.1.cs @@ -0,0 +1,21 @@ +namespace DefaultNamespace; + +public class ex_1 +{ + static void Main(string[] args) + { + Console.WriteLine("=== РЕГИСТРАЦИЯ КОМАНДЫ ==="); + string[] pokemonNames = new string[3]; + for (int i = 0; i < pokemonNames.Length; i++) + { + Console.Write($"Видите имя покемона №{i + 1}: "); + pokemonNames[i] = Console.ReadLine(); + } + Console.WriteLine(); + Console.WriteLine("--- Ваша команда на этот бой ---"); + Console.WriteLine($"1. {pokemonNames[0]}"); + Console.WriteLine($"2. {pokemonNames[1]}"); + Console.WriteLine($"1. {pokemonNames[0]}"); + + } +} \ No newline at end of file diff --git a/works/ex.2.cs b/works/ex.2.cs new file mode 100644 index 0000000..f7d1b9b --- /dev/null +++ b/works/ex.2.cs @@ -0,0 +1,21 @@ +namespace DefaultNamespace; +using System.Collections.Generic; +public class ex_2 +{ + static void Main() + { + List backpack = new List(); + backpack.Add("Зелья HP"); + backpack.Add("Покебол"); + backpack.Add("Антидот"); + + Console.WriteLine("Вы положили вещи в сумку. Предметов в инвентаре: " + backpack.Count); + + backpack.Remove("Покебол"); + Console.WriteLine("Вы использовали один Покебол для поимки дикого покемона!"); + + Console.WriteLine("Обновленный инвентарь. Осталось предметов: " + backpack.Count); + + + } +} \ No newline at end of file diff --git a/works/ex.3.cs b/works/ex.3.cs new file mode 100644 index 0000000..1e45707 --- /dev/null +++ b/works/ex.3.cs @@ -0,0 +1,31 @@ +namespace DefaultNamespace; +using System.Collections.Generic; +public class ex_3 +{ + static void Main() + { + List backpack = new List(); + backpack.Add("Зелья HP"); + backpack.Add("Покебол"); + backpack.Add("Антидот"); + + Console.WriteLine("=== ИНВЕНТАРЬ ТРЕНЕРА ==="); + Console.WriteLine("Вы положили вещи в сумку. Предметов в инвентаре: " + backpack.Count); + + backpack.Remove("Покебол"); + Console.WriteLine("Вы использовали один Покебол для поимки дикого покемона!"); + + Console.WriteLine("Обновленный инвентарь. Осталось предметов: " + backpack.Count); + + Console.WriteLine(); + Console.WriteLine("--- Содержимое вашей сумки ---"); + foreach (string item in backpack) + { + Console.WriteLine($"[Предмет] -> {item}"); + + } + Console.WriteLine("============================="); + + + } +} \ No newline at end of file