Advertisement
Rodunskiy

Untitled

Jun 4th, 2023
56
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 2.27 KB | None | 0 0
  1. class Program
  2. {
  3.     static void Main(string[] args)
  4.     {
  5.         const string AddDossierCommand = "1";
  6.         const string OutputEntireDossierCommand = "2";
  7.         const string DeleteDossierCommand = "3";
  8.         const string ExitCommand = "4";
  9.  
  10.         Dictionary<string, string> dossier = new Dictionary<string, string>();
  11.  
  12.         string userInput;
  13.  
  14.         bool isWorking = true;
  15.  
  16.         while (isWorking)
  17.         {
  18.             Console.Clear();
  19.             Console.ForegroundColor = ConsoleColor.Green;
  20.             Console.WriteLine("Выберите действие:");
  21.             Console.ForegroundColor = ConsoleColor.White;
  22.             Console.WriteLine($"{AddDossierCommand} <-- Добавить досье.\n{OutputEntireDossierCommand} <-- Вывод всего досье.\n{DeleteDossierCommand}" +
  23.                 $" <-- Удалить досье.\n{ExitCommand} <-- Выход.");
  24.             userInput = Console.ReadLine();
  25.             Console.Clear();
  26.  
  27.             switch (userInput)
  28.             {
  29.                 case AddDossierCommand:
  30.                     Console.WriteLine("Введите ФИО сотрудника");
  31.                     string fio = Console.ReadLine();
  32.                     Console.WriteLine("Введите должность сотрудника");
  33.                     string post = Console.ReadLine();
  34.                     dossier.Add( fio, post );
  35.                     break;
  36.                    
  37.  
  38.                 case OutputEntireDossierCommand:
  39.                     foreach(var item in dossier)
  40.                     {
  41.                         Console.WriteLine($"{item.Key} - {item.Value}");
  42.                     }
  43.                     Console.ReadKey();
  44.                     break;
  45.  
  46.                 case DeleteDossierCommand:
  47.                     string deleteFio = Console.ReadLine();
  48.                     dossier.Remove(deleteFio);
  49.                     break;
  50.  
  51.                 case ExitCommand:
  52.                     isWorking = false;
  53.                     break;
  54.             }
  55.         }
  56.  
  57.         Console.ForegroundColor = ConsoleColor.Green;
  58.         Console.WriteLine("Нажмите любую клавишу что-бы выйти из программы.");
  59.         Console.ForegroundColor = ConsoleColor.White;
  60.     }
  61. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement