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); }
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); }