Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- namespace CSLight
- {
- class Program
- {
- static void Main(string[] args)
- {
- string password = "qazwsxedc";
- string userInput;
- string secretMessage = "Доступ разрешён";
- int maxTry = 3;
- for (int i = 1; i <= maxTry; i++)
- {
- Console.Write($"Попытка #{i}: ");
- userInput = Console.ReadLine();
- if (userInput == password)
- {
- Console.WriteLine("\n" + secretMessage + "\n");
- Console.ReadKey();
- break;
- }
- else if (userInput != password && i != maxTry)
- {
- Console.WriteLine("\nПовторите ввод!\n");
- }
- }
- Console.ReadKey();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement