Skip to content

Instantly share code, notes, and snippets.

@Kanol
Created January 26, 2015 14:24
Show Gist options
  • Save Kanol/a515025aade94749e6a1 to your computer and use it in GitHub Desktop.
Save Kanol/a515025aade94749e6a1 to your computer and use it in GitHub Desktop.
string pass = "123456";
List<char> passChar = new List<char>();
while (true)
{
ConsoleKeyInfo cki = Console.ReadKey(true);
if (cki.Key == ConsoleKey.Enter)
break;
else
{
Console.Write("*");
passChar.Add(cki.KeyChar);
}
}
Console.WriteLine();
string passStr = null;
foreach (char c in passChar)
passStr += c;
if (pass == passStr) Console.WriteLine("Пароль правильный");
else Console.WriteLine("Пароль не правильный");
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment