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 HomeWorck_2_6_2
- {
- class Program
- {
- static void Main(string[] args)
- {
- bool programIsWorking = true;
- string userName;
- string userPassword;
- string checkPassword;
- userName = userPassword = checkPassword = "";
- while (programIsWorking)
- {
- Console.WriteLine("Введите команду \"/help\" - для ознакомления. ");
- string command = Console.ReadLine();
- switch (command)
- {
- case "/help":
- Console.WriteLine("/SetName – установить имя \n/ChangeConsoleColor - изменить цвет консоли " +
- "\n/SetPassword – установить пароль \n/WriteName – вывести имя (после ввода пароля) \n/Esc – выход из программы");
- break;
- case "/SetName ":
- Console.Write("Введите Ваше имя ");
- userName = Console.ReadLine();
- Console.WriteLine($"Ваше имя: {userName}");
- break;
- case "/ChangeConsoleColor":
- Console.ForegroundColor = ConsoleColor.Magenta;
- Console.BackgroundColor = ConsoleColor.Yellow;
- break;
- case "/SetPassword":
- Console.WriteLine("Установите свой пароль: ");
- userPassword = Console.ReadLine();
- Console.WriteLine("Пароль успешно установлен!");
- break;
- case "/WriteName":
- Console.Write("Чтобы узнать имя введите пароль: ");
- checkPassword = Console.ReadLine();
- if (checkPassword == userPassword)
- Console.WriteLine($"Имя пользователя: {userName}");
- else
- Console.WriteLine("Пароль неверный!");
- break;
- case "/Esc":
- programIsWorking = false;
- break;
- default:
- Console.WriteLine("Вы ввели неверную команду. Воспользуйтесь изучите команды(/help)");
- break;
- }
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement