private static Random random = new Random();
public static void Main(String[] args)
String[] usernames = new String[5];
int[] passwords = new int[5];
for (userIndex = 0 ; userIndex <= usernames.Length - 1 ; userIndex += 1)
random1 = random.Next(26) + 65;
random1 = random.Next(26) + 65;
random1 = random.Next(26) + 65;
userConc = (char) (int1) + (char) (int2) + (char) (int3);
usernames[userIndex] = userConc;
for (passIndex = 0 ; passIndex <= passwords.Length - 1 ; passIndex += 1)
random2 = random.Next(900) + 100;
passwords[passIndex] = random2;
Console.WriteLine("Usernames, Passwords:");
Console.WriteLine(" " + usernames[0] + ", " + passwords[0]);
Console.WriteLine(" " + usernames[1] + ", " + passwords[1]);
Console.WriteLine(" " + usernames[2] + ", " + passwords[2]);
Console.WriteLine(" " + usernames[3] + ", " + passwords[3]);
Console.WriteLine(" " + usernames[4] + ", " + passwords[4]);
Console.WriteLine("Please enter your username: ");
Console.WriteLine("Please enter your password: ");
if (userInput == usernames[0] && passInput == passwords[0])
if (userInput == usernames[1] && passInput == passwords[1])
if (userInput == usernames[2] && passInput == passwords[2])
if (userInput == usernames[3] && passInput == passwords[3])
if (userInput == usernames[4] && passInput == passwords[4])
Console.WriteLine("Invalid username or password, please try again.");
Console.WriteLine("Please enter your username: ");
Console.WriteLine("Please enter your password: ");
loopCount = loopCount + 1;
if (userInput == usernames[0] && passInput == passwords[0])
if (userInput == usernames[1] && passInput == passwords[1])
if (userInput == usernames[2] && passInput == passwords[2])
if (userInput == usernames[3] && passInput == passwords[3])
if (userInput == usernames[4] && passInput == passwords[4])
Console.WriteLine("Access granted.");
Console.WriteLine("Access denied.");
private static void input(out double result)
while (!double.TryParse(Console.ReadLine(), out result));
private static void input(out int result)
while (!int.TryParse(Console.ReadLine(), out result));
private static void input(out Boolean result)
while (!Boolean.TryParse(Console.ReadLine(), out result));
private static void input(out string result)
result = Console.ReadLine();