generated from admin/template
55 lines
2.2 KiB
Markdown
55 lines
2.2 KiB
Markdown
# Лабораторная работа №4
|
|
|
|
* **Студент:** [Тимонина Э.С.]
|
|
* **Вариант / Карточка:** [Например: #025 Pikachu]
|
|
|
|
---
|
|
|
|
## Ключевой код
|
|
```csharp internal class Program internal class Program
|
|
{
|
|
static void Main(string[] args)
|
|
{
|
|
//те самые массивы
|
|
printZnum(1);
|
|
string[] activeTeam = new string[3];
|
|
Console.WriteLine("=== Регистрация команды ===");
|
|
for (int i = 0; i < activeTeam.Length; i++)
|
|
{
|
|
Console.Write($"Введите имя покемона №{i + 1}: ");
|
|
activeTeam[i] = Console.ReadLine();
|
|
}
|
|
|
|
Console.WriteLine("\n=== Ваша команда на этот бой ===");
|
|
Console.WriteLine($"1. {activeTeam[0]}");
|
|
Console.WriteLine($"2. {activeTeam[1]}");
|
|
Console.WriteLine($"3. {activeTeam[2]}");
|
|
|
|
//те самые листы
|
|
printZnum(2);
|
|
Console.WriteLine("=== ИНВЕНТАРЬ ТРЕНЕРА ===");
|
|
List<string> inventory = new List<string>();
|
|
inventory.Add("Покебол");
|
|
inventory.Add("Зелье");
|
|
inventory.Add("Яблоко");
|
|
Console.WriteLine($"Вы положили вещи в сумку. Предметов в инвентаре: {inventory.Count}");
|
|
inventory.RemoveAt(0);
|
|
Console.WriteLine($"Вы использовали один Покебол для поимки дикого покемона!");
|
|
Console.WriteLine($"Обновленный инвентарь.Осталось предметов: {inventory.Count}");
|
|
|
|
//тот самый foreach
|
|
printZnum(3);
|
|
Console.WriteLine("=== Содержимое вашей сумки ===");
|
|
foreach (string item in inventory)
|
|
{
|
|
Console.WriteLine($"[Предмет] -> {item}");
|
|
}
|
|
|
|
}
|
|
static void printZnum(int num)
|
|
{
|
|
Console.ForegroundColor = ConsoleColor.Red;
|
|
Console.WriteLine($"\n----- задание {num} -----");
|
|
Console.ResetColor();
|
|
}
|
|
} |