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 CSLight_Console_Menu_HW
- {
- class Program
- {
- static void Main(string[] args)
- {
- Console.OutputEncoding = Encoding.UTF8;
- string userInput;
- string wantToContinue;
- string setName = string.Empty;
- string setPassword = string.Empty;
- string setPasswordCheck;
- string colorChange = string.Empty;
- Console.WriteLine("Приветствую! Я - JARVIS. Могу я вам с чем нибудь помочь?\n");
- Console.WriteLine("Вот что я могу для вас сделать:\n");
- Console.WriteLine("1 - установить имя пользователя.");
- Console.WriteLine("2 - изменить цвет консоли.");
- Console.WriteLine("3 - установить пароль.");
- Console.WriteLine("4 - вывести имя.");
- Console.WriteLine("5 - вывести все возможные команды.");
- Console.WriteLine("6 - очистить историю сообщений.");
- Console.WriteLine("7 - выход из программы.\n");
- Console.Write("Вы хотите продолжить (Yes/No): ");
- wantToContinue = Console.ReadLine();
- if (wantToContinue == "No")
- {
- Console.ForegroundColor = ConsoleColor.Green;
- Console.WriteLine("\nУдачи, сэр!");
- }
- while (wantToContinue == "Yes")
- {
- Console.Write("\nВведите команду для инициализации: ");
- userInput = Console.ReadLine();
- if (userInput == "7")
- {
- Console.ForegroundColor = ConsoleColor.Green;
- Console.WriteLine("\nВсего хорошего!");
- break;
- }
- switch (userInput)
- {
- case "1":
- Console.Write("\nВведите имя пользователя: ");
- setName = Console.ReadLine();
- Console.WriteLine("\nИмя пользователя задано успешно!");
- break;
- case "2":
- Console.Write("\nКакой цвет вы хотите установить (Red, Blue, White): ");
- colorChange = Console.ReadLine();
- if (colorChange == "Red")
- Console.ForegroundColor = ConsoleColor.Red;
- else if (colorChange == "Blue")
- Console.ForegroundColor = ConsoleColor.Blue;
- else if (colorChange == "White")
- Console.ForegroundColor = ConsoleColor.White;
- Console.WriteLine($"\nЦвет консоли изменен на - {colorChange}");
- break;
- case "3":
- Console.Write("\nВведите новый пароль: ");
- setPassword = Console.ReadLine();
- Console.WriteLine("\nНовый пароль установлен!");
- break;
- case "4":
- Console.Write("\nВведите пароль: ");
- setPasswordCheck = Console.ReadLine();
- if (setPasswordCheck == setPassword)
- Console.WriteLine($"\nВаше имя - {setName}");
- else
- Console.WriteLine("\nНельзя выполнить операцию!");
- break;
- case "5":
- Console.WriteLine("\n1 - установить имя пользователя.");
- Console.WriteLine("2 - изменить цвет консоли.");
- Console.WriteLine("3 - установить пароль.");
- Console.WriteLine("4 - вывести имя.");
- Console.WriteLine("5 - вывести все возможные команды.");
- Console.WriteLine("6 - очистить историю сообщений.");
- Console.WriteLine("7 - выход из программы.");
- break;
- case "6":
- Console.Clear();
- Console.WriteLine("\nИстория очищена!");
- break;
- }
- }
- Console.ReadKey();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment