Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- namespace ConsoleApplication4
- {
- class Program
- {
- static void Main(string[] args)
- {
- string[] usernames = { "user1", "user2", "user3" };
- string[] passwords = { "1111", "2222", "3333" };
- // data variables
- string username = "john";
- string password = "doe";
- // keyboard input
- string user = "";
- string pass = "";
- do {
- Console.WriteLine("Please enter username:");
- user = Console.ReadLine();
- Console.WriteLine("Please enter password:");
- pass = Console.ReadLine();
- for (int i = 0; i < usernames.Length; i++)
- {
- if (user == usernames[i])
- {
- if (pass == passwords[i])
- {
- Console.WriteLine("Welcome to our system!");
- username = usernames[i];
- password = passwords[i];
- }
- else
- {
- Console.WriteLine("Invalid password");
- }
- }
- }
- } while (username != user || password != pass);
- Console.ReadKey();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement