Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- namespace TaskWithApp
- {
- class Program
- {
- static void Main(string[] args)
- {
- string setName;
- string changeConsoleColor;
- string setPasssword;
- string password;
- int tryPassCount;
- string exit = " ";
- while (exit != "Esc")
- {
- tryPassCount = 3;
- Console.Write("Назовите себя: ");
- setName = Console.ReadLine();
- Console.Write("Установите пароль:");
- setPasssword = Console.ReadLine();
- password = setPasssword;
- while (tryPassCount-- > 0)
- {
- Console.Write("Введите пароль: ");
- password = Console.ReadLine();
- if(password == setPasssword)
- {
- Console.WriteLine("Знаешь что, " + setName + " ?");
- Console.WriteLine("Ты большой молодец!");
- break;
- }
- else if(tryPassCount == 0)
- {
- Console.WriteLine("Попытки кончились, увы дружок");
- }
- else
- {
- Console.WriteLine("Знаешь, пароль не верен - Попробуй ещё раз ");
- }
- }
- Console.WriteLine("Какой цвет текста вы хотите установить? \n Красный \n Зеленый \n Синий \n Желтый \n Нажмите Enter - чтобы установить цвет текста белого цвета");
- changeConsoleColor = Console.ReadLine().ToLower();
- Console.ForegroundColor = changeConsoleColor switch
- {
- "красный" => ConsoleColor.Red,
- "зеленый" => ConsoleColor.Green,
- "синий" => ConsoleColor.Blue,
- "желтый" => ConsoleColor.DarkYellow,
- _ => ConsoleColor.White,
- };
- Console.Write("Если вы хотите закончить программу напишите Esc :");
- exit = Console.ReadLine();
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement