Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- namespace menu
- {
- class Program
- {
- static void Main(string[] args)
- {
- string name = "noname";
- string password = "qwerty";
- string userInput = "";
- Console.WriteLine("Приветствую вас в консольном меню. Подсказка выводится по команде Help.");
- while (userInput != "Esc")
- {
- Console.Write("Введите команду: ");
- userInput = Console.ReadLine();
- switch (userInput)
- {
- case "SetName":
- Console.Write("Введите новое имя: ");
- name = Console.ReadLine();
- break;
- case "ChangeConsoleColor":
- Console.ForegroundColor = ConsoleColor.Green;
- break;
- case "SetPassword":
- Console.Write("Введите новый пароль: ");
- password = Console.ReadLine();
- break;
- case "WriteName":
- Console.Write("Чтобы увидеть имя введите пароль: ");
- userInput = Console.ReadLine();
- if (userInput == password)
- {
- Console.WriteLine(name);
- }
- else
- {
- Console.WriteLine("Неправельный пароль.");
- }
- break;
- case "Help":
- Console.WriteLine("SetName - установить имя.");
- Console.WriteLine("ChangeConsoleColor - поменять цвет консоли");
- Console.WriteLine("SetPassword - установить пароль.");
- Console.WriteLine("WriteName - вывести имя.");
- Console.WriteLine("Help - вывести подсказку.");
- Console.WriteLine("Esc - выйти из программы.");
- break;
- }
- }
- Console.WriteLine("Выход из программы. Пока, пока!");
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement