Advertisement
dmitryEfremov

Untitled

Apr 11th, 2020
51
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.26 KB | None | 0 0
  1. using System;
  2. class Dmitry
  3. {
  4. static void Main()
  5. {
  6. Console.Title = "Dmitry";
  7. Console.ForegroundColor = ConsoleColor.Red;
  8. Console.SetCursorPosition(30, 0);
  9. Console.WriteLine("Создание меню!");
  10. Console.ForegroundColor = ConsoleColor.Green;
  11. string info = "Введите одну из комманд:\nWritePassword - показать пароль.\nSetName – установить имя.\nChangeConsoleColor - изменить цвет консоли.\nSetPassword – установить пароль.\nWriteName – вывести имя (после ввода пароля).\nEsc – выход из программы.";
  12. Console.WriteLine(info);
  13. string password = "Нет пароля.";
  14. string name = "Нет имени";
  15. string exite = "Start";
  16. while (true)
  17. {
  18. string input = Console.ReadLine();
  19. switch (input)
  20. {
  21. case "WritePassword":
  22. Console.WriteLine(password);
  23. break;
  24. case "SetName":
  25. Console.Write("Введите имя:\nИмя-");
  26. name = Console.ReadLine();
  27. break;
  28. case "ChangeConsoleColor":
  29. Console.WriteLine("Введите цвет консоли. Красный? Синий? Зелёный?");
  30. string color = Console.ReadLine();
  31. switch (color)
  32. {
  33. case "Синий":
  34. Console.BackgroundColor = ConsoleColor.Blue;
  35. Console.Clear();
  36. Console.WriteLine(info);
  37. break;
  38. case "Красный":
  39. Console.BackgroundColor = ConsoleColor.Red;
  40. Console.Clear();
  41. Console.WriteLine(info);
  42. break;
  43. case "Зелёный":
  44. Console.BackgroundColor = ConsoleColor.Green;
  45. Console.Clear();
  46. Console.WriteLine(info);
  47. break;
  48. default:
  49. Console.WriteLine("Вы не выбрали цвет! Повторите попытку");
  50. break;
  51. }
  52. break;
  53. case "SetPassword":
  54. Console.Write("Придумайте пароль.\nПароль-");
  55. password = Console.ReadLine();
  56. break;
  57. case "WriteName":
  58. Console.WriteLine(name);
  59. break;
  60. case "Esc":
  61. exite = "Esc";
  62. break;
  63. default:
  64. Console.WriteLine("Вы не ввели комманду. Попробуйте снова.");
  65. break;
  66. }
  67. if (exite == "Esc")
  68. {
  69. break;
  70. }
  71. }
  72. }
  73. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement