Advertisement
TargeTPoweR

Untitled

Mar 22nd, 2020
103
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.88 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6.  
  7. namespace Tasks
  8. {
  9. class Program
  10. {
  11. static void Main(string[] args)
  12. {
  13. string command;
  14. string password;
  15. string myName;
  16. int firstNumber;
  17. int secondNumber;
  18.  
  19. while (true)
  20. {
  21. Console.WriteLine("Здравствуйте, что вы хотите сделать?");
  22. Console.WriteLine("Для установки пароля введите SetPassword.");
  23. Console.WriteLine("Для вывода вашего имени введите WriteMyName.");
  24. Console.WriteLine("Для изменения цвета консоли введите ChangeConsoleColour.");
  25. Console.WriteLine("Для сложения двух чисел введите NumberSum.");
  26. Console.WriteLine("Для того, чтобы вернуть цвет консоли введите ResetColour.");
  27. Console.WriteLine("Для выхода введите Exit.");
  28. command = Console.ReadLine();
  29. if (command == "Exit")
  30. {
  31. break;
  32. }
  33.  
  34. switch (command)
  35. {
  36. case "SetPassword":
  37. Console.WriteLine("Введите пароль.");
  38. password = Console.ReadLine();
  39. Console.WriteLine($"Вы установили пароль {password}.");
  40. break;
  41. case "WriteMyName":
  42. myName = Console.ReadLine();
  43. Console.WriteLine($"Ваше имя {myName}.");
  44. break;
  45. case "ChangeConsoleColour":
  46. Console.BackgroundColor = ConsoleColor.Blue;
  47. break;
  48. case "NumberSum":
  49. Console.WriteLine("Введите первое число:");
  50. firstNumber = Convert.ToInt32(Console.ReadLine());
  51. Console.WriteLine("Введите второе число:");
  52. secondNumber = Convert.ToInt32(Console.ReadLine());
  53. int summNumbers = firstNumber + secondNumber;
  54. Console.WriteLine($"Сумма введённых вами чисел = {summNumbers}.");
  55. break;
  56. case "ResetColour":
  57. Console.ResetColor();
  58. break;
  59. default:
  60. Console.WriteLine("Нет такой команды!!!");
  61. break;
  62. }
  63. }
  64. }
  65. }
  66. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement