Advertisement
Guest User

Untitled

a guest
Jan 27th, 2019
141
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.91 KB | None | 0 0
  1. using System;
  2.  
  3. namespace Login
  4. {
  5. class Program
  6. {
  7. static void Main(string[] args)
  8. {
  9. string username = Console.ReadLine();
  10. char[] password = username.ToCharArray();
  11. Array.Reverse(password);
  12. string pass = new string(password);
  13. int counter = 0;
  14.  
  15. string inputPass = Console.ReadLine();
  16. while (inputPass != pass)
  17. {
  18. Console.WriteLine("Incorrect password. Try again.");
  19. counter++;
  20. inputPass = Console.ReadLine();
  21. if (counter == 3)
  22. {
  23. Console.WriteLine($"User {username} blocked!");
  24. return;
  25. }
  26. }
  27. if (inputPass == pass)
  28. {
  29. Console.WriteLine($"User {username} logged in.");
  30. }
  31.  
  32. }
  33. }
  34. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement