Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- internal class Program
- {
- static void Main(string[] args)
- {
- const string SecretMessage = "Теперь ты знаешь секрет ˆ_ˆ";
- const string Password = "1234";
- int inputAttemps = 3;
- string? userInput = "";
- for (int i = inputAttemps; i > 0; i--)
- {
- Console.Write("Введите пароль: ");
- userInput = Console.ReadLine();
- --inputAttemps;
- if (userInput != Password)
- {
- Console.WriteLine("Пароль введень неверно.");
- Console.WriteLine($"Осталось {inputAttemps} попыток.\n" +
- $"Нажмите на любую клавишу...");
- Console.ReadKey();
- Console.Clear();
- }
- else if (userInput == Password)
- {
- Console.Clear();
- Console.WriteLine(SecretMessage);
- Console.ReadKey();
- break;
- }
- }
- if (userInput != Password)
- {
- Console.WriteLine("Исчерпан лимит попыток.\nТы не узнал секрет.");
- Console.ReadKey();
- Console.Clear();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment