Skip to content

Instantly share code, notes, and snippets.

@MagSosiq
Created May 15, 2024 22:17
Show Gist options
  • Save MagSosiq/71b223023602d04621f4ef5ac6d0209e to your computer and use it in GitHub Desktop.
Save MagSosiq/71b223023602d04621f4ef5ac6d0209e to your computer and use it in GitHub Desktop.
using System;
using System.Text;
namespace HW1
{
internal class Program
{
static void Main(string[] args)
{
Console.InputEncoding = Encoding.Unicode;
Console.OutputEncoding = Encoding.Unicode;
const string CommandShowText = "1";
const string CommandShowRandomNumber = "2";
const string CommandClearConsole = "3";
const string CommandExit = "4";
bool isWork = true;
string userInput;
while (isWork)
{
Console.WriteLine("Добро пожаловать в меню выбора команд<3");
Console.WriteLine("Команды для выполнения: ");
Console.WriteLine($"{CommandShowText} Описание предприятия.");
Console.WriteLine($"{CommandShowRandomNumber} Показать случайное число.");
Console.WriteLine($"{CommandClearConsole} Очистить консоль.");
Console.WriteLine($"{CommandExit} Выход из программы.");
userInput = Console.ReadLine();
Random random = new Random();
int randomNumber = random.Next();
string companyName;
string occupation;
int proffit;
switch (userInput)
{
case CommandShowText:
Console.WriteLine("Введите название, род деятельности и прибыль вашего предприятия: ");
Console.Write("Название: ");
companyName = Console.ReadLine();
Console.Write("Род деятельности: ");
occupation = Console.ReadLine();
Console.Write("Прибыль: ");
proffit = Convert.ToInt32(Console.ReadLine());
Console.WriteLine($"Ваше предприятие с названием: {companyName}, занимающееся: {occupation}, имеет {proffit} прибыли!");
break;
case CommandShowRandomNumber:
Console.WriteLine("Случайное число: " + randomNumber);
break;
case CommandClearConsole:
Console.Clear();
break;
case CommandExit:
isWork = false;
Console.WriteLine("Программа завершена!");
break;
default:
Console.WriteLine("Такой команды нет.");
break;
}
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment