Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- namespace ConsoleApp3
- {
- class Program
- {
- static void Main(string[] args)
- {
- List<string> fullName = new List<string> { "Гришин Аверьян Вячеславович", "Гурьев Ермак Альвианович", "Уварова Инна Оскаровна", "Комиссарова Нора Лукьяновна", "Гордеева Герда Еремеевна" };
- List<string> post = new List<string> { "Специалист", "Специалист", "Старшый специалист", "Руководитель группы", "Начальник отдела" };
- while (true)
- {
- Console.WriteLine("1 - добавить досье\n2 - вывести все досье\n3 - удалить досье\n4 - выход");
- Console.Write("Ввидите команду: ");
- string userInput = Console.ReadLine();
- Console.Clear();
- switch (userInput)
- {
- case "1":
- Console.Write("Ввидите фомилию: ");
- string userInputSurname = Console.ReadLine();
- Console.Write("Ввидите имя: ");
- string userInputName = Console.ReadLine();
- Console.Write("Ввидите отчество: ");
- string userInputPatronymic = Console.ReadLine();
- string userInputFullName = userInputSurname + " " + userInputName + " " + userInputPatronymic;
- AddDossier(fullName, userInputFullName);
- Console.Write("Ввидите должность: ");
- string userInputPost = Console.ReadLine();
- AddDossier(post, userInputPost);
- Console.WriteLine("Новое досье: " + userInputFullName + " - " + userInputPost);
- break;
- case "2":
- ShowDossier(fullName, post);
- break;
- case "3":
- Console.Write("Ввидите номер досье: ");
- int index = Convert.ToInt32(Console.ReadLine()) - 1;
- DeleteDossier(fullName, index);
- DeleteDossier(post, index);
- Console.WriteLine("Досье №" + (index + 1) + " удаленно.");
- break;
- case "4":
- Environment.Exit(50);
- break;
- }
- Console.Write("Нажмите Enter чтобы вернуться в меню.");
- Console.ReadLine();
- Console.Clear();
- }
- }
- static void AddDossier(List<string> list, string userInput)
- {
- list.Add(userInput);
- }
- static void ShowDossier(List<string> fullName, List<string> post)
- {
- for (int i = 0; i < fullName.Count; i++)
- {
- Console.WriteLine("Досье сотрудника: №" + (i + 1) + " " + fullName[i] + " - " + post[i]);
- }
- }
- static void DeleteDossier(List<string> list, int index)
- {
- list.RemoveAt(index);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement