Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- public class Program
- {
- public static void Main()
- {
- Console.WriteLine("Hello World");
- var userEntries = new Dictionary<string,string>();
- var line = Console.ReadLine();
- var count = 0;
- while(line != "login")
- {
- var input=line.Split();
- var username = input [0];
- var password = input [input.Length - 1];
- userEntries[username] = password;
- line = Console.ReadLine();
- }
- line = Console.ReadLine();
- while(line != "end")
- {
- var input=line.Split();
- var logInUsername = input [0];
- var logInPassword = input [input.Length - 1];
- if (!userEntries.ContainsKey(logInUsername) || !userEntries.ContainsValue(logInPassword))
- {
- Console.WriteLine("{0}: login failed",logInUsername);
- count ++;
- }
- else
- {
- Console.WriteLine("{0}: logged in successfully",logInUsername);
- }
- line = Console.ReadLine();
- }
- Console.WriteLine("unsuccessful login attempts: {0}",count);
- }
- }
Add Comment
Please, Sign In to add comment