Neon1x1st

SM

Dec 26th, 2021 (edited)
1,069
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.04 KB | None | 0 0
  1. using System;
  2. using System.Linq;
  3. using System.Collections.Generic;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6. namespace CSharpLight
  7. {
  8.  
  9.     public static class Program
  10.     {
  11.         public static void Main()
  12.         {
  13.             int tryCountMin = 0;
  14.             int tryCount = 3;
  15.             string password = "Qwerty12345@";
  16.             string secretMessage = "Код от сейфа с печеньками:6534";
  17.  
  18.             for (int i = tryCount;i > tryCountMin;i--)
  19.             {
  20.                 Console.WriteLine("Введите пароль:");
  21.                 string userInput = Console.ReadLine();
  22.                 if (userInput == password)
  23.                 {
  24.                     Console.WriteLine(secretMessage);
  25.                     break;
  26.                 }
  27.                 else
  28.                 {
  29.                     tryCount--;
  30.                     Console.WriteLine("Пароль неверен!\nУ вас осталось попыток: " + tryCount);
  31.                 }
  32.             }
  33.            
  34.         }
  35.     }
  36. }
Add Comment
Please, Sign In to add comment