Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- static void Main(string[] args)
- {
- string password = "пирог";
- int inputAttempts = 3;
- string userInput;
- for(int i = 0; i < inputAttempts; i++)
- {
- Console.Write("Введите пароль, чтобы получить доступ к серверу:");
- userInput = Console.ReadLine();
- if (password == userInput)
- {
- Console.Write("Доступ получен!");
- Console.ReadKey();
- break;
- }
- else
- {
- Console.WriteLine($"У вас осталось {inputAttempts - i - 1} попытки");
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement