Advertisement
LeRoY_Go

Untitled

Jun 30th, 2020
116
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.46 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3.  
  4. namespace ConsoleApp3
  5. {
  6. class Program
  7. {
  8. static void Main(string[] args)
  9. {
  10. List<string> fullName = new List<string> { "Гришин Аверьян Вячеславович", "Гурьев Ермак Альвианович", "Уварова Инна Оскаровна", "Комиссарова Нора Лукьяновна", "Гордеева Герда Еремеевна" };
  11. List<string> post = new List<string> { "Специалист", "Специалист", "Старшый специалист", "Руководитель группы", "Начальник отдела" };
  12. while (true)
  13. {
  14. Console.WriteLine("1 - добавить досье\n2 - вывести все досье\n3 - удалить досье\n4 - выход");
  15. Console.Write("Введите команду: ");
  16. string userInput = Console.ReadLine();
  17. Console.Clear();
  18. switch (userInput)
  19. {
  20. case "1":
  21. Console.Write("Введите фамилию: ");
  22. string userInputSurname = Console.ReadLine();
  23. Console.Write("Введите имя: ");
  24. string userInputName = Console.ReadLine();
  25. Console.Write("Введите отчество: ");
  26. string userInputPatronymic = Console.ReadLine();
  27. string userInputFullName = userInputSurname + " " + userInputName + " " + userInputPatronymic;
  28. AddDossier(fullName, userInputFullName);
  29.  
  30. Console.Write("Введите должность: ");
  31. string userInputPost = Console.ReadLine();
  32. AddDossier(post, userInputPost);
  33. Console.WriteLine("Новое досье: " + userInputFullName + " - " + userInputPost);
  34. break;
  35. case "2":
  36. ShowDossier(fullName, post);
  37. break;
  38. case "3":
  39. Console.Write("Введите номер досье: ");
  40. int index = Convert.ToInt32(Console.ReadLine()) - 1;
  41. DeleteDossier(fullName, index);
  42. DeleteDossier(post, index);
  43. Console.WriteLine("Досье №" + (index + 1) + " удаленно.");
  44. break;
  45. case "4":
  46. Environment.Exit(50);
  47. break;
  48. }
  49. Console.Write("Нажмите Enter чтобы вернуться в меню.");
  50. Console.ReadLine();
  51. Console.Clear();
  52. }
  53. }
  54.  
  55. static void AddDossier(List<string> list, string userInput)
  56. {
  57. list.Add(userInput);
  58. }
  59.  
  60. static void ShowDossier(List<string> fullName, List<string> post)
  61. {
  62. for (int i = 0; i < fullName.Count; i++)
  63. {
  64. Console.WriteLine("Досье сотрудника: №" + (i + 1) + " " + fullName[i] + " - " + post[i]);
  65. }
  66. }
  67.  
  68. static void DeleteDossier(List<string> list, int index)
  69. {
  70. list.RemoveAt(index);
  71. }
  72. }
  73. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement