Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- class Dmitry
- {
- static void Main()
- {
- Console.Title = "Dmitry";
- Console.ForegroundColor = ConsoleColor.Red;
- Console.SetCursorPosition(30, 0);
- Console.WriteLine("Создание меню!");
- Console.ForegroundColor = ConsoleColor.Green;
- string info = "Введите одну из комманд:\nWritePassword - показать пароль.\nSetName – установить имя.\nChangeConsoleColor - изменить цвет консоли.\nSetPassword – установить пароль.\nWriteName – вывести имя (после ввода пароля).\nEsc – выход из программы.";
- Console.WriteLine(info);
- string password = "Нет пароля.";
- string name = "Нет имени";
- string exite = "Start";
- while (true)
- {
- string input = Console.ReadLine();
- switch (input)
- {
- case "WritePassword":
- Console.WriteLine(password);
- break;
- case "SetName":
- Console.Write("Введите имя:\nИмя-");
- name = Console.ReadLine();
- break;
- case "ChangeConsoleColor":
- Console.WriteLine("Введите цвет консоли. Красный? Синий? Зелёный?");
- string color = Console.ReadLine();
- switch (color)
- {
- case "Синий":
- Console.BackgroundColor = ConsoleColor.Blue;
- Console.Clear();
- Console.WriteLine(info);
- break;
- case "Красный":
- Console.BackgroundColor = ConsoleColor.Red;
- Console.Clear();
- Console.WriteLine(info);
- break;
- case "Зелёный":
- Console.BackgroundColor = ConsoleColor.Green;
- Console.Clear();
- Console.WriteLine(info);
- break;
- default:
- Console.WriteLine("Вы не выбрали цвет! Повторите попытку");
- break;
- }
- break;
- case "SetPassword":
- Console.Write("Придумайте пароль.\nПароль-");
- password = Console.ReadLine();
- break;
- case "WriteName":
- Console.WriteLine(name);
- break;
- case "Esc":
- exite = "Esc";
- break;
- default:
- Console.WriteLine("Вы не ввели комманду. Попробуйте снова.");
- break;
- }
- if (exite == "Esc")
- {
- break;
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement