예제 #1
0
    public static void makeGuesses()
    {
        Console.WriteLine("Is your number higher or lower than " + Highlow.number + "? (Higher/Lower/Correct)");
        answer = Console.ReadLine();

        if (answer == "correct" || answer == "Correct" || answer == "c")
        {
            Console.WriteLine("Great! Thanks for playing!");
        }
        else if (answer == "Higher" || answer == "higher" || answer == "h")
        {
            Highlow.higherGuess(Highlow.number);
            makeGuesses();
        }
        else if (answer == "Lower" || answer == "lower" || answer == "l")
        {
            Highlow.lowerGuess(Highlow.number);
            makeGuesses();
        }
        else
        {
            Console.WriteLine("Please enter a valid response.");
            makeGuesses();
        }
    }
예제 #2
0
    static void Main()
    {
        Console.WriteLine("Let's play a number guessing game. Would you like to pick a number (Option 1), or should I pick a number for you to guess (Option 2)?");
        answer = Console.ReadLine();

        if (answer == "1" || answer == "option 1" || answer == "Option 1")
        {
            Console.WriteLine("Okay. Pick a number between 1 and 100. Hit 'Y' when you are ready.");
            answer = Console.ReadLine();
            if (answer == "y" || answer == "Y")
            {
                Highlow.initialGuess();
                makeGuesses();
            }
        }

        if (answer == "2" || answer == "option 2" || answer == "Option 2")
        {
            Highlow.initialGuess();
            Console.WriteLine("Okay. I have chosen a number between 1 and 100. Tell me your guess.");
            userGuesses();
        }
    }