From 03cc74fdfac535ba6921357cec5d5cc428102e68 Mon Sep 17 00:00:00 2001 From: 328p <328p@BTK.MAIN> Date: Wed, 23 Sep 2026 11:36:42 +0300 Subject: [PATCH] yaghouldeadinside --- works/cisharp/lab-03/all (1).cs | 44 +++++++++++++++++++++++++++++++++ works/cisharp/lab-03/all (2).cs | 25 +++++++++++++++++++ works/cisharp/lab-03/all.cs | 22 +++++++++++++++++ 3 files changed, 91 insertions(+) create mode 100644 works/cisharp/lab-03/all (1).cs create mode 100644 works/cisharp/lab-03/all (2).cs create mode 100644 works/cisharp/lab-03/all.cs diff --git a/works/cisharp/lab-03/all (1).cs b/works/cisharp/lab-03/all (1).cs new file mode 100644 index 0000000..6af98c0 --- /dev/null +++ b/works/cisharp/lab-03/all (1).cs @@ -0,0 +1,44 @@ +using System; + +public class Test +{ + public static void Main() + { +string name1 = "Пикачу", name2 = "Булбазавр"; +int hp1 = 50, hp2 = 55; +int atk1 = 12, atk2 = 10; +int round = 1; + +while (hp1 > 0 && hp2 > 0) +{ + Console.WriteLine($"\n--- Раунд {round} ---"); + + hp2 -= atk1; + Console.WriteLine($"{name1} наносит {atk1} урона по {name2}!"); + if (hp2 <= 0) + { + hp2 = 0; + Console.WriteLine($"{name2} потерял сознание!"); + break; + } + + hp1 -= atk2; + Console.WriteLine($"{name2} наносит {atk2} урона по {name1}!"); + if (hp1 <= 0) + { + hp1 = 0; + Console.WriteLine($"{name1} потерял сознание!"); + break; + } + + Console.WriteLine($"Итог раунда: {name1} HP: {hp1} | {name2} HP: {hp2}"); + round++; +} + +Console.WriteLine("\n=== БОЙ ОКОНЧЕН ==="); +if (hp1 > 0) + Console.WriteLine($"Победитель: {name1}!"); +else + Console.WriteLine($"Победитель: {name2}!"); + } +} diff --git a/works/cisharp/lab-03/all (2).cs b/works/cisharp/lab-03/all (2).cs new file mode 100644 index 0000000..7500faa --- /dev/null +++ b/works/cisharp/lab-03/all (2).cs @@ -0,0 +1,25 @@ +using System; + +public class Test +{ + public static void Main() + { + Console.WriteLine("Приготовьтесь!"); +for (int i = 3; i >= 1; i--) + Console.WriteLine($"{i}..."); + +Console.WriteLine("=== БОЙ НАЧИНАЕТСЯ ==="); + +string pokemon1Name = "Пикачу"; +int pokemon1Hp = 50; +int pokemon1Attack = 12; + +string pokemon2Name = "Булбазавр"; +int pokemon2Hp = 55; +int pokemon2Attack = 10; + +int roundNumber = 1; + +Console.WriteLine($"{pokemon1Name} (HP: {pokemon1Hp} | Атака: {pokemon1Attack}) VS {pokemon2Name} (HP: {pokemon2Hp} | Атака: {pokemon2Attack})"); + } +} diff --git a/works/cisharp/lab-03/all.cs b/works/cisharp/lab-03/all.cs new file mode 100644 index 0000000..ad4aa60 --- /dev/null +++ b/works/cisharp/lab-03/all.cs @@ -0,0 +1,22 @@ +using System; + +public class Test +{ + public static void Main() + { + int choice; +do +{ + Console.Write("Готовы начать бой? (1 - Да, 0 - Нет): "); + choice = int.Parse(Console.ReadLine()); + + if (choice == 0) + { + Console.WriteLine("Вы отменили бой!"); + return; + } + if (choice != 1) + Console.WriteLine("Некорректная команда! Попробуйте снова."); +} while (choice != 1); + } +}