Advertisement
OwlyOwl

ovoshebaza

Jun 29th, 2020
98
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 2.10 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Runtime.CompilerServices;
  4. using System.Linq;
  5.  
  6. namespace testing
  7. {
  8.     class Program
  9.     {
  10.         static void Main(string[] args)
  11.         {
  12.             Dictionary<string, string> workers = new Dictionary<string, string>();
  13.             bool quitRequest = false;
  14.             while (quitRequest != true)
  15.             {
  16.                 Console.WriteLine("Меню:\n1.Добавить досье\n2.Вывести все досье\n3.Удалить досье\n4.Выход");
  17.                 int input = Convert.ToInt32(Console.ReadLine());
  18.                 switch (input)
  19.                 {
  20.                     case 1:
  21.                         Console.WriteLine("Введите ФИО:");
  22.                         string newName = Console.ReadLine();
  23.                         Console.WriteLine("Введите должность:");
  24.                         string newPosition = Console.ReadLine();
  25.                         workers.Add(newName, newPosition);
  26.                         Console.Clear();
  27.                         break;
  28.                     case 2:
  29.                         int i = 1;
  30.                         foreach (var item in workers)
  31.                         {
  32.                             Console.Write(i + " " + item.Key + " " + item.Value + " ");
  33.                             i++;
  34.                         }
  35.                         Console.ReadKey();
  36.                         Console.Clear();
  37.                         break;
  38.                     case 3:
  39.                         Console.WriteLine("Введи ФИО удаляемого досье - ");
  40.                         string fileToRemove = Console.ReadLine();
  41.                         workers.Remove(fileToRemove);
  42.                         Console.Clear();
  43.                         break;
  44.                     case 4:
  45.                         quitRequest = true;
  46.                         Console.Clear();
  47.                         Console.WriteLine("Завершение работы программы...");
  48.                         break;
  49.                 }
  50.             }
  51.         }
  52.     }
  53. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement