Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- namespace ConsoleApp84
- {
- class Program
- {
- static void Main(string[] args)
- {
- string pass = "7A7";
- string getPassword = null;
- byte numberAtempts = 5;
- byte numbeIncorrectAttempts = 0;
- do
- {
- Console.WriteLine("Введите пароль: ");
- getPassword = Console.ReadLine();
- if (pass != getPassword)
- {
- numbeIncorrectAttempts++;
- Console.ForegroundColor = ConsoleColor.Red;
- Console.WriteLine("Пароль не верный:");
- Console.ForegroundColor = ConsoleColor.Gray;
- Console.Write("У вас осталось ");
- Console.BackgroundColor = ConsoleColor.Red;
- Console.Write(numberAtempts - numbeIncorrectAttempts);
- Console.BackgroundColor = ConsoleColor.Black;
- Console.WriteLine(" попытки.");
- }
- else
- {
- Console.ForegroundColor = ConsoleColor.Yellow;
- Console.WriteLine("Добро пожаловать, вы ввели верный пароль !!!");
- Console.ForegroundColor = ConsoleColor.Gray;
- }
- } while (pass != getPassword && numberAtempts != numbeIncorrectAttempts);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement