Anonim_999

Untitled

Dec 12th, 2020 (edited)
759
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.26 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6.  
  7. namespace ConsoleApp5
  8. {
  9.     class Program
  10.     {
  11.         static void Main(string[] args)
  12.         {
  13.             string password = "blabla123";
  14.             int tryCount = 3;
  15.             for (int x = tryCount; x > 0; x--)
  16.             {
  17.                 Console.WriteLine($"У вас есть {x} попыток\nВведите пароль: ");
  18.                 string userInput = Console.ReadLine();
  19.                 if (userInput == password)
  20.                 {
  21.                     Console.WriteLine("Вы вошли!");
  22.                     Console.ForegroundColor = ConsoleColor.Red;
  23.                     Console.WriteLine("Конец света будет 23 декабря 2020 года!!!");
  24.                     Console.ResetColor();
  25.                     Console.ReadKey();
  26.                     break;
  27.                 }
  28.                 else
  29.                 {
  30.                     Console.WriteLine("Пароль введен не верно\nНажмите любую клавишу, чтобы продолжить...");
  31.                     Console.ReadKey();
  32.                 }
  33.                 Console.Clear();
  34.             }
  35.         }
  36.     }
  37. }
Advertisement
Add Comment
Please, Sign In to add comment