Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- namespace Othertask
- {
- internal class Program
- {
- static void Main(string[] args)
- {
- Console.OutputEncoding = Encoding.UTF8;
- int userInput;
- int setColor;
- string password;
- string setName;
- string setPassword = "123456";
- bool appActive = true;
- while (appActive)
- {
- Console.WriteLine("Выберите нужную команду");
- Console.WriteLine("\n 1- Установить имя. \n2- Изменить цвет консоли. \n3- Установить пароль. \n4- Вывести имя. \n5- Выход из программы");
- userInput = Convert.ToInt32(Console.ReadLine());
- switch (userInput)
- {
- case 1:
- Console.Write("Установите имя:");
- setName = Console.ReadLine();
- Console.Clear();
- break;
- case 2:
- Console.WriteLine("Вы собираетесь поменять цвет консоли.\n Выберете цвет");
- Console.Write("1: Красный. \n 2: Зеленный ");
- setColor = Convert.ToInt32(Console.ReadLine());
- if (setColor == 1)
- {
- Console.ForegroundColor = ConsoleColor.Red;
- Console.Clear();
- }
- else if (setColor == 2)
- {
- Console.ForegroundColor = ConsoleColor.Green;
- Console.Clear();
- }
- break;
- case 3:
- Console.Write("Установите пароль:");
- setPassword = Console.ReadLine();
- Console.Clear();
- break;
- case 4:
- Console.WriteLine("Если вы введете верный пароль вы сможете установить имя");
- Console.Write("Введите пароль: ");
- password = Console.ReadLine();
- if (password == setPassword)
- {
- Console.WriteLine("Введите ваше имя:");
- setName = Console.ReadLine();
- Console.WriteLine("Имя пользователя: " + setName);
- }
- else
- {
- Console.WriteLine("Пароль неверный.");
- }
- break;
- case 5:
- Console.WriteLine("Вы вышли из меню!");
- appActive = false;
- break;
- }
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment