Hi, I want to create a program where 5 people enter there name, and the computer randomly picks a name and says they have won. I have tried it with a for loop, but I have never been good with for loops. I don not want an integer to appear, I want their input! This is my code:
Any improvements to the for loop to make it display the above wishes?
string[] name = new string[4];
Console.WriteLine("Please enter name 1");
name[0] = Console.ReadLine();
Console.WriteLine("Please enter name 2");
name[1] = Console.ReadLine();
Console.WriteLine("Please enter name 3");
name[2] = Console.ReadLine();
Console.WriteLine("Please enter name 4");
name[3] = Console.ReadLine();
Console.WriteLine("Please enter name 5");
name[4] = Console.ReadLine();
for (int i = 0; i < []name; i++) ;
{
Console.WriteLine("Well done" + name[i] + " , you are the winner");
}
Console.ReadLine();
Any improvements to the for loop to make it display the above wishes?