Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- namespace Lesson2
- {
- class Program
- {
- static void Main(string[] args)
- {
- string correctPasword = "12345";
- int maxAttempts = 5;
- for (int currentAttempt = 0; currentAttempt < maxAttempts; currentAttempt++)
- {
- Console.Write("Введи пароль: ");
- string password = Console.ReadLine();
- bool isCorrect = password.Equals(correctPasword);
- if (isCorrect)
- {
- Console.WriteLine("Встречаемся на тропинке за гаражами, возьми вилку.");
- Console.ReadLine();
- Environment.Exit(0);
- }
- else
- {
- Console.WriteLine("Неверный пароль, попробуй еще.");
- }
- }
- Console.WriteLine("Превышено количество попыток ввода пароля.");
- Console.ReadLine();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement