Advertisement
Guest User

Untitled

a guest
Oct 22nd, 2019
121
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.05 KB | None | 0 0
  1. namespace Lesson2
  2. {
  3. class Program
  4. {
  5. static void Main(string[] args)
  6. {
  7. string correctPasword = "12345";
  8. int maxAttempts = 5;
  9.  
  10. for (int currentAttempt = 0; currentAttempt < maxAttempts; currentAttempt++)
  11. {
  12. Console.Write("Введи пароль: ");
  13. string password = Console.ReadLine();
  14.  
  15. bool isCorrect = password.Equals(correctPasword);
  16.  
  17. if (isCorrect)
  18. {
  19. Console.WriteLine("Встречаемся на тропинке за гаражами, возьми вилку.");
  20. Console.ReadLine();
  21. Environment.Exit(0);
  22. }
  23. else
  24. {
  25. Console.WriteLine("Неверный пароль, попробуй еще.");
  26. }
  27. }
  28. Console.WriteLine("Превышено количество попыток ввода пароля.");
  29. Console.ReadLine();
  30. }
  31. }
  32. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement