コード例 #1
0
ファイル: Program.cs プロジェクト: YuliyaKhokhlova/OOP-Tasks
        static void Main(string[] args)
        {
            GuessNumberHost game = new GuessNumberHost();

            game.SayHello();

            GuessNumberHost.Answer answer = GuessNumberHost.Answer.Undefined;
            do
            {
                string input = Console.ReadLine();
                int    guess = -1;
                try
                {
                    guess = Convert.ToInt32(input);
                }
                catch (Exception e)
                {
                    Console.WriteLine("Look's like you've made a mistake: " + e.Message);
                    continue;
                }
                answer = game.GetAnswerAboutNumber(guess);
            }while (answer != GuessNumberHost.Answer.Exactly && answer != GuessNumberHost.Answer.NoMoreTries);
        }
コード例 #2
0
ファイル: Program.cs プロジェクト: YuliyaKhokhlova/OOP-Tasks
        static void Main(string[] args)
        {
            GuessNumberHost game = new GuessNumberHost();
            game.SayHello();

            GuessNumberHost.Answer answer = GuessNumberHost.Answer.Undefined;
            do
            {
                string input = Console.ReadLine();
                int guess = -1;
                try
                {
                    guess = Convert.ToInt32(input);
                }
                catch (Exception e)
                {
                    Console.WriteLine("Look's like you've made a mistake: " + e.Message);
                    continue;
                }
                answer = game.GetAnswerAboutNumber(guess);
            }
            while (answer != GuessNumberHost.Answer.Exactly && answer != GuessNumberHost.Answer.NoMoreTries);
        }