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