generated from admin/template
Обновить works/lab-04/lab_4.cs
This commit is contained in:
@@ -1,57 +1,57 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
|
||||||
namespace lab_4
|
namespace lab_4
|
||||||
{
|
{
|
||||||
internal class Program
|
internal class Program
|
||||||
{
|
{
|
||||||
static void Main(string[] args)
|
static void Main(string[] args)
|
||||||
{
|
{
|
||||||
//те самые массивы
|
//те самые массивы
|
||||||
printZnum(1);
|
printZnum(1);
|
||||||
string[] activeTeam = new string[3];
|
string[] activeTeam = new string[3];
|
||||||
Console.WriteLine("=== Регистрация команды ===");
|
Console.WriteLine("=== Регистрация команды ===");
|
||||||
for (int i = 0; i < activeTeam.Length; i++)
|
for (int i = 0; i < activeTeam.Length; i++)
|
||||||
{
|
{
|
||||||
Console.Write($"Введите имя покемона №{i + 1}: ");
|
Console.Write($"Введите имя покемона №{i + 1}: ");
|
||||||
activeTeam[i] = Console.ReadLine();
|
activeTeam[i] = Console.ReadLine();
|
||||||
}
|
}
|
||||||
|
|
||||||
Console.WriteLine("\n=== Ваша команда на этот бой ===");
|
Console.WriteLine("\n=== Ваша команда на этот бой ===");
|
||||||
Console.WriteLine($"1. {activeTeam[0]}");
|
Console.WriteLine($"1. {activeTeam[0]}");
|
||||||
Console.WriteLine($"2. {activeTeam[1]}");
|
Console.WriteLine($"2. {activeTeam[1]}");
|
||||||
Console.WriteLine($"3. {activeTeam[2]}");
|
Console.WriteLine($"3. {activeTeam[2]}");
|
||||||
|
|
||||||
//те самые листы
|
//те самые листы
|
||||||
printZnum(2);
|
printZnum(2);
|
||||||
Console.WriteLine("=== ИНВЕНТАРЬ ТРЕНЕРА ===");
|
Console.WriteLine("=== ИНВЕНТАРЬ ТРЕНЕРА ===");
|
||||||
List<string> inventory = new List<string>();
|
List<string> inventory = new List<string>();
|
||||||
inventory.Add("Покебол");
|
inventory.Add("Покебол");
|
||||||
inventory.Add("Зелье");
|
inventory.Add("Зелье");
|
||||||
inventory.Add("Яблоко");
|
inventory.Add("Яблоко");
|
||||||
Console.WriteLine($"Вы положили вещи в сумку. Предметов в инвентаре: {inventory.Count}");
|
Console.WriteLine($"Вы положили вещи в сумку. Предметов в инвентаре: {inventory.Count}");
|
||||||
inventory.RemoveAt(0);
|
inventory.RemoveAt(0);
|
||||||
Console.WriteLine($"Вы использовали один Покебол для поимки дикого покемона!");
|
Console.WriteLine($"Вы использовали один Покебол для поимки дикого покемона!");
|
||||||
Console.WriteLine($"Обновленный инвентарь.Осталось предметов: {inventory.Count}");
|
Console.WriteLine($"Обновленный инвентарь.Осталось предметов: {inventory.Count}");
|
||||||
|
|
||||||
//тот самый foreach
|
//тот самый foreach
|
||||||
printZnum(3);
|
printZnum(3);
|
||||||
Console.WriteLine("=== Содержимое вашей сумки ===");
|
Console.WriteLine("=== Содержимое вашей сумки ===");
|
||||||
foreach (string item in inventory)
|
foreach (string item in inventory)
|
||||||
{
|
{
|
||||||
Console.WriteLine($"[Предмет] -> {item}");
|
Console.WriteLine($"[Предмет] -> {item}");
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
static void printZnum(int num)
|
static void printZnum(int num)
|
||||||
{
|
{
|
||||||
Console.ForegroundColor = ConsoleColor.Red;
|
Console.ForegroundColor = ConsoleColor.Red;
|
||||||
Console.WriteLine($"\n----- задание {num} -----");
|
Console.WriteLine($"\n----- задание {num} -----");
|
||||||
Console.ResetColor();
|
Console.ResetColor();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user