Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- const string CommandName = "1";
- const string CommandSurname = "2";
- const string CommandAge = "3";
- const string CommandLogin = "4";
- const string CommandPassword = "5";
- const string CommandChangeTextColor = "6";
- const string CommandChangeConsoleColor = "7";
- const string CommandExit = "8";
- int changeTextColor;
- bool canExit = true;
- string userInput;
- int colorRed = 1;
- int colorBlue = 2;
- while (canExit)
- {
- Console.Clear();
- Console.WriteLine($"Выберите нужную команду:\n {CommandName} <-- Ввести имя.\n {CommandSurname} <-- Ввести фамилию.\n" +
- $" {CommandAge} <-- Ввести возраст.\n {CommandLogin} <-- Ввести логин.\n {CommandPassword} <-- Ввести пароль.\n" +
- $" {CommandChangeTextColor} <-- Поменять цвет текста.\n {CommandChangeConsoleColor} <-- Поменять цвет консоли.\n {CommandExit} <-- Выйти из программы.");
- userInput = Console.ReadLine();
- switch (userInput)
- {
- case CommandName:
- Console.WriteLine("Введите имя:");
- string name = Console.ReadLine();
- break;
- case CommandSurname:
- Console.WriteLine("Введите фамилию:");
- string surname = Console.ReadLine();
- break;
- case CommandAge:
- Console.WriteLine("Введите возраст:");
- string age = Console.ReadLine();
- break;
- case CommandLogin:
- Console.WriteLine("Введите логин");
- string login = Console.ReadLine();
- break;
- case CommandPassword:
- Console.WriteLine("Введите пароль");
- string password = Console.ReadLine();
- break;
- case CommandChangeTextColor:
- Console.WriteLine($"Выберете цвет текста:\n {colorRed} <-- красный.\n {colorBlue} <-- синий");
- changeTextColor = Convert.ToInt32(Console.ReadLine());
- if (changeTextColor == colorRed)
- {
- Console.ForegroundColor = ConsoleColor.Red;
- }
- else if (changeTextColor == colorBlue)
- {
- Console.ForegroundColor = ConsoleColor.Blue;
- }
- break;
- case CommandChangeConsoleColor:
- Console.WriteLine($"Выберете цвет консоли:\n {colorRed} <-- красный.\n {colorBlue} <-- синий");
- changeTextColor = Convert.ToInt32(Console.ReadLine());
- if (changeTextColor == colorRed)
- {
- Console.BackgroundColor = ConsoleColor.Red;
- }
- else if (changeTextColor == colorBlue)
- {
- Console.BackgroundColor = ConsoleColor.Blue;
- }
- break;
- case CommandExit:
- canExit = false;
- break;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement