Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- static void Main(string[] args)
- {
- const string CommandExit = "exit";
- const string CommandLogin = "login";
- const string CommandPassword = "password";
- const string CommandName = "name";
- const string CommandAge = "age";
- const string CommandInfo = "info";
- string inputMessage = "";
- string setLogin = "";
- string setPassword = "";
- string setName = "";
- int setAge = 0;
- bool isWorking = true;
- string commandList = "\n1)login\n2)password\n3)name\n4)age\n5)info\n6)exit\n";
- while (isWorking)
- {
- Console.WriteLine(commandList);
- Console.Write("Введите команду: ");
- inputMessage = Console.ReadLine();
- switch (inputMessage.ToLower())
- {
- case CommandLogin:
- Console.Write("Введите логин: ");
- setLogin = Console.ReadLine();
- Console.Clear();
- break;
- case CommandPassword:
- Console.Write("Введите пароль: ");
- setPassword = Console.ReadLine();
- Console.Clear();
- break;
- case CommandName:
- Console.Write("Введите имя: ");
- setName = Console.ReadLine();
- Console.Clear();
- break;
- case CommandAge:
- Console.Write("Введите возраст: ");
- setAge = Convert.ToInt32(Console.ReadLine());
- Console.Clear();
- break;
- case CommandInfo:
- Console.WriteLine("::::информация об аккаунте::::");
- Console.WriteLine($"Ваше имя: {setName}\nВаш логин: {setLogin}\nВаш возраст: " +
- $"{setAge}\nВаш пароль: {setPassword}\n");
- Console.Write("Нажмите 'Enter' чтобы вернутся в меню комманд");
- Console.ReadKey();
- Console.Clear();
- break;
- case CommandExit:
- Console.WriteLine("Вы вышли!");
- isWorking = false;
- break;
- default:
- Console.WriteLine($"Вы ввели: {inputMessage}, комманда не распознана! Нажмите 'Enter'");
- Console.ReadKey();
- Console.Clear();
- break;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement