generated from admin/template
121 lines
3.6 KiB
C#
121 lines
3.6 KiB
C#
// http://5.35.127.219:3001/admin/daily-24.11-228/src/branch/main/task.md
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
|
|
namespace ConsoleApp
|
|
{
|
|
class Program
|
|
{
|
|
static void Main(string[] args)
|
|
{
|
|
Zadania_1();
|
|
Zadania_2();
|
|
Zadania_3();
|
|
Zadania_4();
|
|
Zadania_5();
|
|
|
|
}
|
|
|
|
static void Zadania_1()
|
|
{
|
|
Console.WriteLine("Задача 1. Переменные покемона");
|
|
string name = Console.ReadLine();
|
|
string type = Console.ReadLine();
|
|
int level = int.Parse(Console.ReadLine() ?? "");
|
|
int hp = int.Parse(Console.ReadLine());
|
|
double attack = double.Parse(Console.ReadLine());
|
|
bool isShiny = false;
|
|
|
|
Console.WriteLine($"{name},{type},LVL: {level},HP: {hp},Atk: {attack},shiny: {isShiny}");
|
|
|
|
level = level + 1;
|
|
hp = hp - 30;
|
|
Console.WriteLine("Изменение данных.");
|
|
Console.WriteLine($"{name},{type},LVL: {level},HP: {hp},Atk: {attack},shiny: {isShiny}");
|
|
}
|
|
|
|
static void Zadania_2()
|
|
{
|
|
string[] types = { "fire", "water", "electric", "dragon" };
|
|
|
|
foreach (string attackerType in types)
|
|
{
|
|
if (attackerType == "fire")
|
|
{
|
|
Console.WriteLine("Огонь силён против травы");
|
|
}
|
|
else if (attackerType == "water")
|
|
{
|
|
Console.WriteLine("Вода сильна против огня");
|
|
}
|
|
else if (attackerType == "grass")
|
|
{
|
|
Console.WriteLine("Трава сильна против воды");
|
|
}
|
|
else if (attackerType == "electric")
|
|
{
|
|
Console.WriteLine("Электричество сильно против воды");
|
|
}
|
|
else
|
|
{
|
|
Console.WriteLine("Тип не изучен");
|
|
}
|
|
}
|
|
}
|
|
|
|
static void Zadania_3()
|
|
{
|
|
string name = "water";
|
|
switch (name)
|
|
{
|
|
case "fire":
|
|
Console.WriteLine("Огонь");
|
|
break;
|
|
case "water":
|
|
Console.WriteLine("Вода");
|
|
break;
|
|
case "grass":
|
|
Console.WriteLine("Трава");
|
|
break;
|
|
default:
|
|
Console.WriteLine("Неизвестный тип");
|
|
break;
|
|
}
|
|
}
|
|
|
|
static void Zadania_4()
|
|
{
|
|
int hp = 100;
|
|
int round = 0;
|
|
while (hp > 0)
|
|
{
|
|
round++;
|
|
hp -= 17;
|
|
}
|
|
|
|
Console.WriteLine($"Покемон продержался {round} раундов, HP = {hp}");
|
|
for (int i = 0; i <= 10; i++)
|
|
{
|
|
if (i % 3 == 0) continue;
|
|
if (i == 7) break;
|
|
if (i % 2 != 0)
|
|
{
|
|
Console.Write($"{i}");
|
|
}
|
|
}
|
|
}
|
|
|
|
static void Zadania_5()
|
|
{
|
|
List<string> Pokemon = new List<string>() { "Pokemon 1", "Pokemon 2", "Charmander", "Pokemon 4" };
|
|
Pokemon.Remove("Pokemon 2");
|
|
Pokemon.Add("Pokemon 5");
|
|
|
|
string otvet = [""];
|
|
}
|
|
}
|
|
}
|