Advertisement
Rodunskiy

Untitled

Apr 9th, 2023
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 2.71 KB | None | 0 0
  1. string SetName;
  2. string SetSurname;
  3. string SetAge;
  4. string SetLogin;
  5. string SetPassword;
  6. int ChangeTextColor;
  7. string ChangeConsoleColor;
  8. string WriteAllData;
  9. bool Exit = true;
  10. string UserInput;
  11.  
  12. while (Exit)
  13. {
  14.     Console.WriteLine("Выберите нужную команду:\n 1 <-- Ввести имя.\n 2 <-- Ввести фамилию.\n 3 <-- Ввести возраст.\n 4 <-- Ввести логин.\n 5 <-- Ввести пароль.\n 6 <-- Поменять цвет текста.\n 7 <-- Поменять цвет консоли.\n 8 <-- Выйти из программы.");
  15.     UserInput = Console.ReadLine();
  16.  
  17.     switch (UserInput)
  18.     {
  19.         case "1":
  20.             Console.WriteLine("Введите имя:");
  21.             SetName = Console.ReadLine();
  22.             Console.Clear();
  23.             break;
  24.  
  25.         case "2":
  26.             Console.WriteLine("Введите фамилию:");
  27.             SetSurname = Console.ReadLine();
  28.             Console.Clear();
  29.             break;
  30.  
  31.         case "3":
  32.             Console.WriteLine("Введите возраст:");
  33.             SetAge = Console.ReadLine();
  34.             Console.Clear();
  35.             break;
  36.  
  37.         case "4":
  38.             Console.WriteLine("Введите логин");
  39.             SetLogin = Console.ReadLine();
  40.             Console.Clear();
  41.             break;
  42.  
  43.         case "5":
  44.             Console.WriteLine("Введите пароль");
  45.             SetPassword = Console.ReadLine();
  46.             Console.Clear();
  47.             break;
  48.  
  49.         case "6":
  50.             Console.WriteLine("Выберете цвет текста:\n 1 <-- красный.\n 2 <-- синий");
  51.             ChangeTextColor = Convert.ToInt32(Console.ReadLine());
  52.  
  53.             if (ChangeTextColor == 1 )
  54.             {
  55.                 Console.ForegroundColor = ConsoleColor.Red;
  56.             }
  57.             else if (ChangeTextColor == 2 )
  58.             {
  59.                 Console.ForegroundColor = ConsoleColor.Blue;
  60.             }
  61.             Console.Clear();
  62.             break;
  63.  
  64.         case "7":
  65.             Console.WriteLine("Выберете цвет консоли:\n 1 <-- зеленый.\n 2 <-- жёлтый");
  66.             ChangeTextColor = Convert.ToInt32(Console.ReadLine());
  67.  
  68.             if (ChangeTextColor == 1)
  69.             {
  70.                 Console.BackgroundColor = ConsoleColor.Green;
  71.             }
  72.             else if (ChangeTextColor == 2)
  73.             {
  74.                 Console.BackgroundColor = ConsoleColor.Yellow;
  75.             }
  76.             Console.Clear();
  77.             break;
  78.  
  79.         case "8":
  80.             Exit = false;
  81.             break;
  82.  
  83.         default:
  84.             Console.Clear();
  85.             break;
  86.     }
  87. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement