Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class Program
- {
- static void Main(string[] args)
- {
- string textCommands = "Команды!!\n" +
- "Показать команды: \'1\'\n" +
- "Пополнить баланс: \'2\'\n" +
- "Заказать еду: \'3\'\n" +
- "Проверить баланс: \'4\'\n" +
- "Сменить пароль: \'5\'\n" +
- "Очистить консоль: \'6\'\n" +
- "Выйти: \'7\'";
- string userInput = "";
- int balance = 100;
- string password = "qwerty";
- int priceDelivery = 20;
- bool isExit = false;
- Console.WriteLine(textCommands);
- while (!isExit)
- {
- Console.WriteLine("Введите команду: ");
- userInput = Console.ReadLine();
- switch (userInput)
- {
- case "1":
- Console.WriteLine(textCommands);
- break;
- case "2":
- Console.WriteLine("Введите сумму");
- balance += Convert.ToInt32(Console.ReadLine());
- Console.WriteLine("Успешное пополние!!");
- break;
- case "3":
- Console.WriteLine($"Ваш курьер в пути. ( - {20}$)");
- balance -= priceDelivery;
- break;
- case "4":
- Console.WriteLine($"Ваш баланc - {balance}$");
- break;
- case "5":
- userInput = Console.ReadLine();
- if (userInput == password)
- {
- Console.WriteLine("Введите новый пароль");
- password = Console.ReadLine();
- }
- else
- {
- Console.WriteLine("Неверный пароль!!");
- }
- break;
- case "6":
- Console.Clear();
- break;
- case "7":
- isExit = true;
- break;
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement