Files
Grishenko-prog/works/lab-01/Readme.md
T

91 lines
3.4 KiB
Markdown

# Лабораторная работа №1
* Студент: [Грищенко Екатерина Ильинична]
---
## Ключевой код
*Первое задание*
```csharp
string pokemonName1 = "Чармандер";
string elementType1 = "Огонь";
int level = 1;
int hp = 95;
Console.WriteLine("=== БАЗА ДАННЫХ ПОКЕМОНОВ ===");
Console.WriteLine($"Покемон: {pokemonName1}");
Console.WriteLine($"Стихия: {elementType1}");
Console.WriteLine($"Уровень: {level} | HP: {hp}");
Console.WriteLine();
```
---
*Второе задание*
```csharp
Console.Write("Введите имя тренера: ");
string trainerName = Console.ReadLine();
Console.Write("Введите имя покемона: ");
string pokemonName2 = Console.ReadLine();
Console.Write("Введите стихию: ");
string elementType2 = Console.ReadLine();
Console.Write("Введите регион: ");
string regionName = Console.ReadLine();
Console.WriteLine();
Console.WriteLine("****************************************");
Console.WriteLine("ПАСПОРТ ПОКЕМОНА");
Console.WriteLine($"Тренер: {trainerName} (Регион: {regionName})");
Console.WriteLine($"Покемон: {pokemonName2} [Стихия: {elementType2}]");
Console.WriteLine("****************************************");
```
# Лабораторная работа №4 (мне переделать нужно)
```csharp
using System;
using System.Collections.Generic;
namespace PokemonLab
{
internal class Program
{
static void Main(string[] args)
{
// Задание 1
Console.WriteLine("=== РЕГИСТРАЦИЯ КОМАНДЫ ===");
string[] activeTeam = new string[3];
for (int i = 0; i < activeTeam.Length; i++)
{
Console.Write($"Введите имя покемона №{i + 1}: ");
activeTeam[i] = Console.ReadLine();
}
Console.WriteLine($"1. {activeTeam[0]}");
Console.WriteLine($"2. {activeTeam[1]}");
Console.WriteLine($"3. {activeTeam[2]}");
// Задание 2
Console.WriteLine("=== ИНВЕНТАРЬ ТРЕНЕРА ===");
List<string> backpack = new List<string>();
backpack.Add("Зелье HP");
backpack.Add("Покебол");
backpack.Add("Антидот");
Console.WriteLine($"Вы положили вещи в сумку. Предметов в инвентаре: {backpack.Count}");
Console.WriteLine("Вы использовали один Покебол для поимки дикого покемона!");
backpack.Remove("Покебол");
Console.WriteLine($"Обновленный инвентарь. Осталось предметов: {backpack.Count}");
Console.WriteLine("--- Содержимое вашей сумки ---");
// Задание 3
foreach (string item in backpack)
{
Console.WriteLine($"[Предмет] -> {item}");
}
Console.WriteLine("=============================");
}
}
}
```