64 720
Assignments Done
99,4%
Successfully Done
In September 2018

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;

do
{
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!

Comments

No comments. Be first!

Leave a comment

Ask Your question

Submit
Privacy policy Terms and Conditions