Created
April 17, 2022 12:26
-
-
Save Mazday21/ee8c56542947f170780b74ce8aa65d9b to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Collections.Generic; | |
using System.Linq; | |
using System.Text; | |
using System.Threading.Tasks; | |
internal class Program | |
{ | |
static void Main(string[] args) | |
{ | |
string tempCommand = String.Empty; | |
int tempNumber; | |
Console.WriteLine("Вас приветствует приложение по обработке команд, введите команду help для списка команд"); | |
while (tempCommand != "exit") | |
{ | |
tempCommand = Console.ReadLine(); | |
if(tempCommand == "help") | |
{ | |
Console.WriteLine("Доступные команды: \"ChangeConsoleColor\", \"SayMyName\", \"SquareNumber\", \"help\", \"exit\""); | |
} | |
else if(tempCommand == "ChangeConsoleColor") | |
{ | |
if(Console.ForegroundColor == ConsoleColor.Gray) | |
{ | |
Console.ForegroundColor = ConsoleColor.Green; | |
} | |
else | |
{ | |
Console.ForegroundColor = ConsoleColor.Gray; | |
} | |
} | |
else if(tempCommand == "SayMyName") | |
{ | |
Console.Write("Введите ваше имя:"); | |
tempCommand = Console.ReadLine(); | |
if(tempCommand == "Mr. White") | |
{ | |
Console.Write("You're goddamn right"); | |
} | |
else | |
{ | |
Console.WriteLine($"Ваше имя: {tempCommand}"); | |
} | |
} | |
else if(tempCommand == "SquareNumber") | |
{ | |
Console.Write("Введите число для возведения во вторую степень:"); | |
tempNumber = Convert.ToInt32(Console.ReadLine()); | |
tempNumber *= tempNumber; | |
Console.WriteLine($"Ответ: {tempNumber}"); | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment