Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- namespace CSLight
- {
- internal class Program
- {
- static void Main(string[] args)
- {
- const string CommandShowText = "1";
- const string CommandClearConsole = "2";
- const string CommandExit = "3";
- const string CommandShowRandomNumber = "4";
- bool isWork = true;
- string userInput;
- Random random = new Random();
- int largerNumber = 100;
- int smallerNumber = 0;
- string firstText = "1";
- string secondText = "2";
- while (isWork)
- {
- Console.WriteLine($"{CommandShowText} - Показать текст");
- Console.WriteLine($"{CommandClearConsole} - Очистить консоль");
- Console.WriteLine($"{CommandExit} - Выход");
- Console.WriteLine($"{CommandShowRandomNumber} - Показать случайное число");
- Console.WriteLine();
- userInput = Console.ReadLine();
- switch (userInput)
- {
- case CommandShowText:
- Console.WriteLine();
- Console.WriteLine($"Какой текст вам показать, {firstText} или {secondText}?");
- Console.WriteLine();
- userInput = Console.ReadLine();
- if (userInput == firstText)
- {
- Console.WriteLine();
- Console.WriteLine("Плата за индивидуальность — одиночество.");
- Console.WriteLine();
- }
- else if (userInput == secondText)
- {
- Console.WriteLine();
- Console.WriteLine("Берегите в себе человека.");
- Console.WriteLine();
- }
- break;
- case CommandClearConsole:
- Console.Clear();
- break;
- case CommandExit:
- isWork = false;
- Console.WriteLine();
- Console.WriteLine("Программа завершена");
- Console.WriteLine();
- break;
- case CommandShowRandomNumber:
- Console.WriteLine();
- int number = random.Next(smallerNumber, largerNumber);
- Console.WriteLine(number);
- Console.WriteLine();
- break;
- default:
- Console.WriteLine("Такой команды нет.");
- break;
- }
- }
- Console.ReadKey();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement