Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- namespace ConsoleApp
- {
- internal class Program
- {
- static void Main(string[] args)
- {
- const string CreateNewPasswordCommand = "new password";
- const string ShowPrivateInformationCommand = "private information";
- const string ChangeBackgroundColourCommand = "change background colour";
- const string ChangeFontColourCommand = "change font colour";
- const string ExitCommand = "exit";
- string redColourName = "красный";
- string blueColourName = "синий";
- string whiteColourName = "белый";
- string grayColourName = "серый";
- string greenColourName = "зеленый";
- string password = "0000";
- bool isProgramActive = true;
- Console.WriteLine($"Доступные команды:\n{CreateNewPasswordCommand}\n{ShowPrivateInformationCommand}\n{ChangeBackgroundColourCommand}\n{ChangeFontColourCommand}\n{ExitCommand}\n");
- while (isProgramActive)
- {
- Console.Write("Введите команду: ");
- string command = Console.ReadLine();
- switch (command)
- {
- case CreateNewPasswordCommand:
- Console.Write("Введите текущий пароль: ");
- string userInput = Console.ReadLine();
- if (userInput == password)
- {
- Console.Write("Введите новый пароль: ");
- password = Console.ReadLine();
- Console.WriteLine("Пароль успешно изменен!\n");
- }
- else
- {
- Console.WriteLine("Введен неверный пароль!\n");
- }
- break;
- case ShowPrivateInformationCommand:
- Console.Write("Введите текущий пароль: ");
- userInput = Console.ReadLine();
- if (userInput == password)
- {
- Console.WriteLine("Приватная информация\n");
- }
- else
- {
- Console.WriteLine("Введен неверный пароль!\n");
- }
- break;
- case ChangeBackgroundColourCommand:
- Console.WriteLine("Какой цвет ты хочешь установить?");
- userInput = Console.ReadLine();
- if (userInput == redColourName)
- {
- Console.BackgroundColor = ConsoleColor.Red;
- }
- else if (userInput == blueColourName)
- {
- Console.BackgroundColor = ConsoleColor.Blue;
- }
- else if (userInput == whiteColourName)
- {
- Console.BackgroundColor = ConsoleColor.White;
- }
- else if (userInput == grayColourName)
- {
- Console.BackgroundColor = ConsoleColor.Gray;
- }
- else if (userInput == greenColourName)
- {
- Console.BackgroundColor = ConsoleColor.Green;
- }
- Console.Clear();
- break;
- case ChangeFontColourCommand:
- Console.WriteLine("Какой цвет ты хочешь установить?");
- userInput = Console.ReadLine();
- if (userInput == redColourName)
- {
- Console.ForegroundColor = ConsoleColor.Red;
- }
- else if (userInput == blueColourName)
- {
- Console.ForegroundColor = ConsoleColor.Blue;
- }
- else if (userInput == whiteColourName)
- {
- Console.ForegroundColor = ConsoleColor.White;
- }
- else if (userInput == grayColourName)
- {
- Console.ForegroundColor = ConsoleColor.Gray;
- }
- else if (userInput == greenColourName)
- {
- Console.ForegroundColor = ConsoleColor.Green;
- }
- break;
- case ExitCommand:
- isProgramActive = false;
- break;
- }
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment