Example #1
0
        public static void Main(string[] args)
        {
            ConsoleKeyInfo cki;

            do
            {
                Console.Clear();
                ForConsole.PrintInfo();

                ForConsole.Write("Введите N:");
                var n = ForConsole.ReadInt();

                ForConsole.Write("Введите K:");
                var k = ForConsole.ReadInt();

                ForConsole.Write(string.Format("Последним останется " + Joseph.Solution(n, k) + "-й человек."));

                Console.WriteLine("Нажмите любую клавишу, чтобы продолжить или Escape (Esc), чтобы выйти:");
                cki = Console.ReadKey();
            }while (cki.Key != ConsoleKey.Escape);
        }
Example #2
0
        public static void Main(string[] args)
        {
            bool     exit = false;
            Commands command;

            while (!exit)
            {
                HelpForConsole.PrintMenu(ClassName.round);
                command = HelpForConsole.SetCommand();

                switch (command)
                {
                case Commands.createDefoult:
                {
                    var round = new Round();
                    ForConsole.PrintRound(round);
                    break;
                }

                case Commands.createWithParam:
                {
                    Console.Write("Enter the center coordinate along the X axis: ");
                    double x = HelpForConsole.CheckAndSetParam();
                    Console.Write("\nEnter the center coordinate along the Y axis: ");
                    double y = HelpForConsole.CheckAndSetParam();
                    Console.Write("\nEnter the radius: ");
                    double radius = HelpForConsole.CheckAndSetParam();
                    var    round  = new Round(x, y, radius);
                    ForConsole.PrintRound(round);
                    break;
                }

                case Commands.exit:
                {
                    exit = true;
                    break;
                }
                }
            }
        }