Hi, I apologize in advance for the ugliness of this code.
Hopefully someone can tell what I am trying to do- which is have a string of names, create a loop through the array of strings, have the console write "Wrong Answer..."
until the user input is the right answer. In this case 3 or Burt is right.
Thanks for any insight.
Hopefully someone can tell what I am trying to do- which is have a string of names, create a loop through the array of strings, have the console write "Wrong Answer..."
until the user input is the right answer. In this case 3 or Burt is right.
Thanks for any insight.
C#:
string[] _Names = new string[4] { "Bill", "Ben", "Burt", "Bob" };
string userInput = Console.ReadLine();
foreach (string in _Names [1, 4])
{
while (userInput != _Names[3])
{
Console.WriteLine("Wrong answer. What was his name?");
}
Console.WriteLine("Yeah that was his name.");
}
}
}