Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Threading;
- namespace HW_2025
- {
- internal class Program
- {
- static void Main(string[] args)
- {
- string userPassword = "";
- string systemPassword = "123Rfv";
- string secretMessage = "Бутерброд надо есть колбасой вниз.";
- int numberTries = 3;
- int exitDelayTime = 3000;
- int timeToExit = 0;
- Console.WriteLine("Введите пароль");
- for (int i = 1; i <= numberTries; i++)
- {
- userPassword = Console.ReadLine();
- if (userPassword == systemPassword)
- {
- Console.WriteLine(secretMessage);
- Console.WriteLine($"Пароль верный, программа закроется через {exitDelayTime} милисекунд...");
- Thread.Sleep(exitDelayTime);
- break;
- }
- else
- {
- timeToExit = numberTries - i;
- Console.WriteLine($"У вас осталось {timeToExit} попыток.");
- }
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement