I am trying to find a way to detect if there is/are the same text in array input
, all five of the Name input must be different, and if there is any similarity, it will automatically request input again.
Example:
Name 1: Max
Address 1: address a
Name 2: Max
Address 2: address b
You can see that both of the name input is similar, i want it to Console.WriteLine("The name is already added, please add a different name);
and request input for Name 2 again.
Just like this:
Name 1: Max
Address 1: address a
Name 2: Max
Address 2: address b
Name is already added, Please input a different name!`
Name 2: Minimum
Here is my code so far:
var a = 5;
string[,] input = new string[a, 2];
for (a = 0; a < 5; a++)
{
Console.Write($"Name {a + 1} : ");
input[a, 0] = Console.ReadLine();
input[a, 0] = input[a, 0].ToLower();
Console.Write($"Address {a + 1} : ");
input[a, 1] = Console.ReadLine();
}
NOTE: This is between five inputs