Advertisement
Rodunskiy

Untitled

May 6th, 2024
498
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.33 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 OutputTextCommand = "1";
  10.             const string OutputRandomNumberCommand = "2";
  11.             const string ClearTextCommand = "3";
  12.             const string ExitProgramCommand = "4";
  13.  
  14.             Random rnd = new Random();
  15.             bool isWorking = true;
  16.  
  17.             while (isWorking)
  18.             {
  19.                 Console.WriteLine($"{OutputTextCommand})Вывести текст.\n{OutputRandomNumberCommand})Сгерерировать число.\n{ClearTextCommand})Очистить консоль.\n{ExitProgramCommand})Выйти из программы.");
  20.  
  21.                 switch (Console.ReadLine())
  22.                 {
  23.                     case OutputTextCommand:
  24.                         Console.WriteLine("Hello World!");
  25.                         break;
  26.  
  27.                     case OutputRandomNumberCommand:
  28.                         int number = rnd.Next(10);
  29.                         break;
  30.  
  31.                     case ClearTextCommand:
  32.                         Console.Clear();
  33.                         break;
  34.  
  35.                     case ExitProgramCommand:
  36.                         isWorking = false;
  37.                     break;
  38.                 }
  39.             }
  40.         }
  41.     }
  42. }
  43.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement