Advertisement
Guest User

Untitled

a guest
Jan 26th, 2019
164
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.00 KB | None | 0 0
  1. using System;
  2.  
  3. namespace P05login
  4. {
  5. class Program
  6. {
  7. static void Main(string[] args)
  8. {
  9. string username = Console.ReadLine();
  10. string passWord = "";
  11.  
  12.  
  13. for (int i = username.Length - 1; i >= 0; i--)
  14. {
  15.  
  16. passWord += username[i];
  17.  
  18. }
  19. string passWordEntered = Console.ReadLine();
  20.  
  21. for (int i = 1; i <=4; i++)
  22. {
  23. if (passWord != passWordEntered && i<4)
  24. {
  25. Console.WriteLine("Incorrect password. Try again.");
  26. passWordEntered = Console.ReadLine();
  27. }
  28. else if(passWord != passWordEntered && i == 4)
  29. {
  30. Console.WriteLine($"User {username} blocked!");
  31. }
  32. else
  33. {
  34. Console.WriteLine($"User {username} logged in.");break;
  35. }
  36. }
  37.  
  38.  
  39.  
  40.  
  41.  
  42. }
  43. }
  44. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement