Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- namespace CSLightFirst
- {
- class Program
- {
- public static void Main()
- {
- Dictionary<string, string> dossiers = new Dictionary<string, string>();
- bool isExit = false;
- Console.WriteLine("Добро пожаловать в базу досье.\nДоступные действия:\n");
- while (!isExit)
- switch (GetUserInputInMainMenu())
- {
- case "1":
- Console.Clear();
- dossiers.Add(GetUserInput("Введите полное имя: "), GetUserInput("Введите должность: "));
- break;
- case "2":
- ShowAllDossiers(dossiers);
- break;
- case "3":
- dossiers.Remove(GetUserInput("Введите ФИО удаляемого досье: "));
- break;
- case "4":
- isExit = true;
- break;
- default:
- Console.Clear();
- Console.WriteLine("Неверная команда, попробуйте ещё раз.");
- break;
- }
- }
- private static string GetUserInputInMainMenu()
- {
- Console.WriteLine("\n1 - Добавить досье\n" +
- "2 - Вывести все досье\n" +
- "3 - Удалить досье\n" +
- "4 - Выход из программы\n");
- Console.Write("Что бы Вы хотели сделать? ");
- return Console.ReadLine();
- }
- private static string GetUserInput(string lineForUser)
- {
- Console.Write(lineForUser);
- return Console.ReadLine();
- }
- private static void ShowAllDossiers(Dictionary<string, string> dossiers)
- {
- Console.Clear();
- Console.WriteLine("Полный список досье:\n" +
- " (№ : Полное имя - Должность)\n");
- int count = 1;
- foreach (KeyValuePair<string, string> dossier in dossiers)
- {
- Console.WriteLine($" {count} : {dossier.Key} - {dossier.Value}");
- count++;
- }
- Console.ReadKey();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement