Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- namespace CSLight
- {
- internal class Program
- {
- static void Main(string[] args)
- {
- string password = "qwerty";
- int attempsCount = 3;
- bool isAccessClosed = false;
- string secretMessage = "Секретное сообщение";
- while (isAccessClosed == false)
- {
- Console.WriteLine("Введите пароль");
- string userInput = Console.ReadLine();
- if (userInput == password)
- {
- Console.WriteLine(secretMessage);
- break;
- }
- else
- {
- attempsCount--;
- if (attempsCount > 0)
- {
- Console.WriteLine($"Неверный пароль. Осталось {attempsCount} попыток");
- }
- else
- {
- Console.WriteLine("Доступ зарпещен");
- isAccessClosed = true;
- }
- }
- }
- Console.ReadLine();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement