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