Neon1x1st

Console

Dec 25th, 2021 (edited)
633
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 3.26 KB | None | 0 0
  1. using System;
  2. using System.Linq;
  3. using System.Collections.Generic;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6. namespace CSharpLight
  7. {
  8.  
  9.     public static class Program
  10.     {
  11.         public static void Main()
  12.         {
  13.             string login;
  14.             string password;
  15.             string email;
  16.             string time;
  17.             do
  18.             {
  19.                 Console.WriteLine("Введите необходимую команду:\nlogin - установить логин для входа\npassword - установить пароль для входа\nemail - указать электронную почту\ntextchangecolor - изменить цвет текста на красный\nconsolechangecolor - изменить цвет консоли на синий\ntime - текущее время\nrandom - случайное число от 1 до 10\nclear - очистить консоль\nкнопка Esc - выход");
  20.                 string userInput = Console.ReadLine();
  21.                 switch (userInput)
  22.                 {
  23.                     case "login":
  24.                         Console.WriteLine("Придумайте себе логин:");
  25.                         login = Console.ReadLine();
  26.                         Console.WriteLine("Ваш логин принят");
  27.                         break;
  28.                     case "password":
  29.                         Console.WriteLine("Придумайте себе пароль:");
  30.                         password = Console.ReadLine();
  31.                         Console.WriteLine("Ваш пароль принят");
  32.                         break;
  33.                     case "email":
  34.                         Console.WriteLine("email:");
  35.                         email = Console.ReadLine();
  36.                         Console.WriteLine("Вы указали свою почту");
  37.                         break;
  38.                     case "textchangecolor":
  39.                         Console.ForegroundColor = ConsoleColor.Red;
  40.                         break;
  41.                     case "consolechangecolor":
  42.                         Console.BackgroundColor = ConsoleColor.Blue;
  43.                         break;
  44.                     case "time":
  45.                         time = Convert.ToString(DateTime.Now);
  46.                         Console.WriteLine(time);
  47.                         break;
  48.                     case "random":
  49.                         Console.WriteLine("Введите число от");
  50.                         int randomMin = Convert.ToInt32(Console.ReadLine());
  51.                         Console.WriteLine("Введите число до");
  52.                         int randomMax = Convert.ToInt32(Console.ReadLine());
  53.                         Random rand = new Random();
  54.                         int randomNumber = rand.Next(randomMin, randomMax);
  55.                         Console.WriteLine(randomNumber);
  56.                         break;
  57.                     case "clear":
  58.                         Console.Clear();
  59.                         break;
  60.                     default:
  61.                         Console.WriteLine("такой команды нет");
  62.                         break;
  63.                 }
  64.             }
  65.             while (Console.ReadKey().Key != ConsoleKey.Escape);
  66.         }
  67.     }
  68. }
  69.  
  70.  
Add Comment
Please, Sign In to add comment