76 836
Assignments Done
Successfully Done
In June 2019

Answer to Question #9814 in C# for Koosie

Question #9814
Console.WriteLine("Please enter your card number");
string crdnum = Console.ReadLine();
int c = Convert.ToInt32(crdnum);

Console.WriteLine("PLease enter your password");
string psswrd = Console.ReadLine();
int p = Convert.ToInt32(psswrd);
int counter = 0;

if (c = i)
//This is where i want to compare the user input with the array but im stuck!!
} while (counter < 3
Expert's answer
As we&#039;ve understood you need you need to check if the input string is in some array. To do it

just use Contains() method without any loop:

//assume that arr is your initial array

bool cardNumberExists = arr.Contains(c);

Don&#039;t forget to add &quot;using System.Linq;&quot; derective as Contains s the extention method for IEnumerable type

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!


No comments. Be first!

Leave a comment

Ask Your question

Privacy policy Terms and Conditions