I have this exercise:
Make a method that generates a random number between 1 and 100.
Ask the user to guess a number between 1 and 100.
Make a method that checks if the user's guess is equal to the random number that has been generated. This method will also say "higher" or "lower" until the user guesses the random number.
I have no problem with steps 1 and 2, but I'm having problems with the 3rd step. Here is my code so far:
static void Main(string[] args)
{
int randomNumber = GenerateRandomNumberMethod();
Console.WriteLine("Guess a number between 1 and 100:");
}
// generate random number method (step 2)
public static int GenerateRandomNumberMethod()
{
Random rdn = new Random();
int random = rd.Next(1,100);
return random;
}
//step 3 (Method to compare guessed number with random number)?
I hope it is not a stupid question, the answer is probably pretty simple.