Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- namespace Hr
- {
- class Program
- {
- static void Main(string[] args)
- {
- List<string> fullName = new List<string>() { "Беляев Матвей Артёмович", "Блажевич Игорь Юрьевич", "Валиева Руфина Рафаэлевна" };
- List<string> positions = new List<string>() { "Event-менеджер", "SEO-оптимизатор", "SMM-менеджер" };
- bool exit = false;
- while (!exit)
- {
- Console.WriteLine("Выберите пункт меню:\n1.Добавить досье\n2.Вывести все досье\n3.Удалить досье\n4.Выход", '-');
- int menu = Convert.ToInt32(Console.ReadLine());
- Console.WriteLine();
- switch (menu)
- {
- case 1:
- AddInformation(fullName, positions);
- break;
- case 2:
- Console.WriteLine("Все досье: ");
- PrintFullNameAndPosition(fullName, positions);
- break;
- case 3:
- RemoveFullNameAndPosition(fullName, positions);
- break;
- case 4:
- exit = true;
- break;
- default:
- Console.WriteLine("Нет такого пункта меню.");
- break;
- }
- }
- Console.ReadKey();
- }
- static void AddInformation(List<string> fullName, List<string> position)
- {
- Console.WriteLine("Введите ФИО: ");
- string enterFullName = Console.ReadLine();
- Console.WriteLine("Введите должность: ");
- string enterPosition = Console.ReadLine();
- fullName.Add(enterFullName);
- position.Add(enterPosition);
- Console.WriteLine();
- }
- static void RemoveFullNameAndPosition(List<string> fullName, List<string> position)
- {
- if (fullName.Count == 0)
- {
- Console.WriteLine("Нет записей.");
- }
- else
- {
- Console.WriteLine("Выберите досье,которое хотите удалить: ");
- int id = Convert.ToInt32(Console.ReadLine());
- Console.WriteLine();
- if (fullName.Count - 1 >= id)
- {
- fullName.RemoveAt(id);
- position.RemoveAt(id);
- Console.WriteLine($"Вы удалили досье под номером - {id}");
- }
- else
- {
- Console.WriteLine($"Досье под номером {id} не существует.");
- }
- }
- Console.WriteLine();
- }
- static void PrintFullNameAndPosition(List<string> fullName, List<string> position)
- {
- if (fullName.Count == 0)
- {
- Console.WriteLine("Нет записей.");
- }
- else
- {
- for (int i = 0; i < fullName.Count; i++)
- {
- Console.WriteLine($"{i}. {fullName[i]} - {position[i]}");
- }
- }
- Console.WriteLine();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement