Advertisement
LeRoY_Go

Untitled

Jun 30th, 2020
91
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.  
  15. Console.WriteLine("1 - добавить досье\n2 - вывести все досье\n3 - удалить досье\n4 - выход");
  16. Console.Write("Ввидите команду: ");
  17. string userInput = Console.ReadLine();
  18. Console.Clear();
  19. switch (userInput)
  20. {
  21. case "1":
  22. Console.Write("Ввидите фомилию: ");
  23. string userInputSurname = Console.ReadLine();
  24. Console.Write("Ввидите имя: ");
  25. string userInputName = Console.ReadLine();
  26. Console.Write("Ввидите отчество: ");
  27. string userInputPatronymic = Console.ReadLine();
  28. string userInputFullName = userInputSurname + " " + userInputName + " " + userInputPatronymic;
  29. AddDossier(fullName, userInputFullName);
  30.  
  31. Console.Write("Ввидите должность: ");
  32. string userInputPost = Console.ReadLine();
  33. AddDossier(post, userInputPost);
  34. Console.WriteLine("Новое досье: " + userInputFullName + " - " + userInputPost);
  35. break;
  36. case "2":
  37. ShowDossier(fullName, post);
  38. break;
  39. case "3":
  40. Console.Write("Ввидите номер досье: ");
  41. int index = Convert.ToInt32(Console.ReadLine()) - 1;
  42. DeleteDossier(fullName, index);
  43. DeleteDossier(post, index);
  44. Console.WriteLine("Досье №" + (index + 1) + " удаленно.");
  45. break;
  46. case "4":
  47. Environment.Exit(50);
  48. break;
  49.  
  50. }
  51. Console.Write("Нажмите Enter чтобы вернуться в меню.");
  52. Console.ReadLine();
  53. Console.Clear();
  54. }
  55. }
  56.  
  57. static void AddDossier(List<string> list, string userInput)
  58. {
  59. list.Add(userInput);
  60. }
  61.  
  62. static void ShowDossier(List<string> fullName, List<string> post)
  63. {
  64. for (int i = 0; i < fullName.Count; i++)
  65. {
  66. Console.WriteLine("Досье сотрудника: №" + (i + 1) + " " + fullName[i] + " - " + post[i]);
  67. }
  68. }
  69.  
  70. static void DeleteDossier(List<string> list, int index)
  71. {
  72. list.RemoveAt(index);
  73. }
  74. }
  75. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement