Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Linq;
- using System.Collections.Generic;
- using System.Text;
- using System.Threading.Tasks;
- namespace CSharpLight
- {
- public static class Program
- {
- public static void Main()
- {
- int tryCountMin = 0;
- int tryCount = 3;
- string password = "Qwerty12345@";
- string secretMessage = "Код от сейфа с печеньками:6534";
- for (int i = tryCount;i > tryCountMin;i--)
- {
- Console.WriteLine("Введите пароль:");
- string userInput = Console.ReadLine();
- if (userInput == password)
- {
- Console.WriteLine(secretMessage);
- break;
- }
- else
- {
- tryCount--;
- Console.WriteLine("Пароль неверен!\nУ вас осталось попыток: " + tryCount);
- }
- }
- }
- }
- }
Add Comment
Please, Sign In to add comment