I'm trying to make a classic lottery style code, where the objective is for the user to choose ten numbers to play with, and then those numbers are compared to a randomly generated number.
So far I got this:
class Program
{
static void Main(string[] args)
{
Console.WriteLine("Hello and Welcome to the Programming Lottery!"); //Just greetings and instructions.
Console.WriteLine("You'll now get to choose ten different numbers to play with. ");
Console.WriteLine("Go ahead and type them in.");
int[] lotteri = new int[10]; //Array to catch ten numbers input.
for (int i=0; i<lotteri.Length; i++)
lotteri[i] = int.Parse(Console.ReadLine());
Console.WriteLine("Very good! Now we'll see if you won anything!");
Random randomNumber = new Random(1-100);
Console.ReadKey();
}
}
That's as far as I got, I think the array is doing what it should (collecting the user input ten times before moving on).
The MAIN PROBLEM for me now is that I want the program to compare those numbers in the array to a randomly chosen number, and if either of those ten user input numbers match with the randomly generated number to tell the user that they've won (or if it doesn't, that they lost). I just can't seem to get it to work!
Secondary problem, but that I'm trying to learn is handling methods better, so if anyone got any tip on how to use the array in a method and then get it to main, that'd be very appreciated as well!