Guest User

Untitled

a guest
Jun 2nd, 2018
174
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.79 KB | None | 0 0
  1. class Program
  2. {
  3. static void Main(string[] args)
  4. {
  5.  
  6. string username, password;
  7. int ctr = 0;
  8. Console.Write("\n\nCheck username and password :\n");
  9. Console.Write("N.B. : Default user name and password is :abcd and 1234\n");
  10. Console.Write("------------------------------------------------------\n");
  11.  
  12. do
  13. {
  14. Console.Write("Input a username: ");
  15. username = Console.ReadLine();
  16.  
  17. Console.Write("Input a password: ");
  18. password = Console.ReadLine();
  19.  
  20. if (username != "abcd" || password != "1234")
  21. ctr++;
  22. else
  23. ctr = 1;
  24.  
  25. }
  26. while ((username != "abcd" || password != "1234") && (ctr != 3));
  27.  
  28. if (ctr == 3)
  29. Console.Write("\nLogin attemp three or more times. Try later!\n\n");
  30. else
  31. Console.Write("\nThe password entered successfully!\n\n");
  32. }
  33. }
  34. }
Add Comment
Please, Sign In to add comment