From 3a49c2969c5bd159a8df52e28df79a4a70e61c10 Mon Sep 17 00:00:00 2001 From: slava_mastio228 Date: Wed, 9 Sep 2026 11:52:48 +0300 Subject: [PATCH] ex2 --- works/lab-03/src/ex2.cs | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 works/lab-03/src/ex2.cs diff --git a/works/lab-03/src/ex2.cs b/works/lab-03/src/ex2.cs new file mode 100644 index 0000000..fdd0055 --- /dev/null +++ b/works/lab-03/src/ex2.cs @@ -0,0 +1,30 @@ +namespace DefaultNamespace; + +public class ex2 +{ + static void Main(string[] args) + { + int choice; + do + { + Console.Write("Готовы начать бой? (1 - Да, 0 - Нет): "); + choice = int.Parse(Console.ReadLine()); + + if (choice != 1 && choice != 0) + { + Console.WriteLine("Некорректная команда! Попробуйте снова."); + } + + } while (choice != 0 && choice != 1); + + if (choice == 0) + { + Console.WriteLine("Вы отменили бой!"); + } + + if (choice == 1) + { + Console.WriteLine("Вы начали бой!"); + } + } +} \ No newline at end of file