Advertisement
yakovmonarh

Untitled

Aug 11th, 2019
154
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.78 KB | None | 0 0
  1. // 1.3.8.1.2 Сделайте счётчик неверных вводов пароля, и при достижение числа 5, завершите программу
  2.  
  3.         public static void Main(string[] args)
  4.         {   string password = "закатун";
  5.             int countPass = 5;
  6.             do
  7.             {
  8.                 Console.Clear();
  9.                 Console.WriteLine("Введите пароль... Попыток: {0}", countPass);
  10.                
  11.             }
  12.             while(password != Console.ReadLine() && --countPass > 0);
  13.            
  14.             if(countPass == 0){
  15.                 Console.Clear();
  16.                 Console.WriteLine("Попыток ввода пароля {0} Окно будет закрыто.", countPass);
  17.                 Console.ReadKey();
  18.                 return;
  19.             }
  20.             Console.WriteLine("Ты познал Кузинатару!");
  21.                
  22.             Console.ReadKey();
  23.         }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement