Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- namespace CSLightFirst
- {
- class Program
- {
- static void Main()
- {
- int attemptCount = 3;
- string password = "qwerty";
- string userInput;
- Console.Write("Пожалуйста, введите пароль: ");
- userInput = Console.ReadLine();
- while(attemptCount > 0)
- {
- if (userInput == password)
- {
- Console.WriteLine("Добро пожаловать в личный кабинет");
- break;
- }
- if (--attemptCount == 0)
- {
- Console.WriteLine("Доступ закрыт, повторите попытку входа завтра");
- break;
- }
- Console.Write($"Пароль неверный, попробуйте ещё (осталось попыток: {attemptCount}): ");
- userInput = Console.ReadLine();
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement