Reputation: 608
I have an array of arrays, called numberSets.
numberSets has 4 arrays called numberSet1, numberSet2, numberSet3 and numberSet4.
Now I have a For Loop that prompts the user to enter in 4 values at separate times. The first input value must be equal to one number from numberSet1, the second input value must be equal to one number from numberSet2 and so on.
What my problem is trying to write the IF statement. e.g:
int input = int.Parse(Console.ReadLine());
if (input == numberSets .... ) {
data[i] = input; //The data variable has 4 arrays too, for the 4 user inputs.
Console.Write("Wowa wee wah, Great success!");
}
else {
Conosle.Write("Sorry you must enter the correct values");
}
Upvotes: 0
Views: 2223
Reputation: 2380
Like this?
for (int i=0; i<4; i++)
{
int input = int.Parse(Console.ReadLine());
if (numberSets[i].Contains(input))
{
// SUCCESS
}
}
Upvotes: 7