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;
- Console.WriteLine("Введите пароль");
- for (int i = 1; i <= numberTries; i++)
- {
- userPassword = Console.ReadLine();
- if (userPassword == systemPassword)
- {
- Console.WriteLine(secretMessage);
- Console.WriteLine($"Пароль верный, программа закроется через {exitDelayTime} секунд...");
- Thread.Sleep(exitDelayTime);
- return;
- }
- else if (i == numberTries)
- {
- return;
- }
- else
- Console.WriteLine($"У вас осталось {numberTries - i} попыток.");
- }
- }
- }
- }
Advertisement
Advertisement