Advertisement
Rodunskiy

Untitled

May 6th, 2024
430
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.69 KB | None | 0 0
  1. using System;
  2.  
  3. namespace CSLight
  4. {
  5.     public class Program
  6.     {
  7.         static void Main(string[] args)
  8.         {
  9.             const string OutputTextCommandOne = "1";
  10.             const string OutputTextCommandTwo = "2";
  11.             const string OutputRandomNumberCommand = "3";
  12.             const string ClearTextCommand = "4";
  13.             const string ExitProgramCommand = "5";
  14.  
  15.             Random random = new Random();
  16.             int maxRandomNumber = 10;
  17.             bool isWorking = true;
  18.  
  19.             while (isWorking)
  20.             {
  21.                 Console.WriteLine($"{OutputTextCommandOne})Вывести первый текст.\n{OutputTextCommandTwo})Вывести второй текст.\n{OutputRandomNumberCommand})Сгерерировать число.\n{ClearTextCommand})Очистить консоль.\n{ExitProgramCommand})Выйти из программы.");
  22.  
  23.                 switch (Console.ReadLine())
  24.                 {
  25.                     case OutputTextCommandOne:
  26.                         Console.WriteLine("Hello World!");
  27.                         break;
  28.  
  29.                     case OutputTextCommandTwo:
  30.                         Console.WriteLine("HHHHEEEEELLLLOOOOO WWOOOOOOOOORLD!!!!!!!!!");
  31.                         break;
  32.  
  33.                     case OutputRandomNumberCommand:
  34.                         int number = random.Next(maxRandomNumber);
  35.                         break;
  36.  
  37.                     case ClearTextCommand:
  38.                         Console.Clear();
  39.                         break;
  40.  
  41.                     case ExitProgramCommand:
  42.                         isWorking = false;
  43.                     break;
  44.                 }
  45.             }
  46.         }
  47.     }
  48. }
  49.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement