Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- namespace Learn1
- {
- class Program
- {
- static void Main(string[] args)
- {
- string[] fullNames = new string[0];
- string[] job = new string[0];
- int userInput;
- bool isActive = true;
- while (isActive)
- {
- Console.WriteLine("Меню:");
- Console.WriteLine("1 - Добавить досье.\n2 - Вывести все досье.\n3 - Удалить досье.\n4 - Поиск по фамилии.\n5 - Выход");
- userInput = Convert.ToInt32(Console.ReadLine());
- switch (userInput)
- {
- case 1:
- Console.Write("Укажите ФИО:");
- string name = Console.ReadLine();
- fullNames = AddDossier(fullNames, name);
- Console.Write("Укажите должность:");
- string position = Console.ReadLine();
- job = AddDossier(job, position);
- break;
- case 2:
- FormativeOutput(fullNames, job);
- break;
- case 3:
- Console.WriteLine("Какое резюме вы хотите удалить?");
- int index = Convert.ToInt32(Console.ReadLine());
- fullNames = DeleteDossier(fullNames, index);
- job = DeleteDossier(job, index);
- Console.Write("Резюме успешно удалено");
- break;
- case 4:
- Console.Write("По какой фамилии искать?:");
- string surname = Console.ReadLine().ToLower();
- FindDataSurname(fullNames, job, surname);
- break;
- case 5:
- isActive = false;
- break;
- }
- }
- Console.WriteLine("До свидания!");
- }
- static string[] AddDossier(string[] array, string data)
- {
- string[] tempName = new string[array.Length + 1];
- for (int i = 0; i < array.Length; i++)
- {
- tempName[i] = array[i];
- }
- tempName[tempName.Length - 1] = data;
- array = tempName;
- return array;
- }
- static void FormativeOutput(string[] fullNames, string[] job)
- {
- int number = 1;
- for (int i = 0; i < fullNames.Length; i++)
- {
- Console.Write($"{number})");
- number++;
- Console.Write(fullNames[i]);
- Console.Write($" - {job[i]}");
- Console.WriteLine();
- }
- }
- static string[] DeleteDossier(string[] array, int index)
- {
- index--;
- string[] tempArray = new string[array.Length - 1];
- for (int i = 0; i < index; i++)
- {
- tempArray[i] = array[i];
- }
- for (int i = index; i < tempArray.Length; i++)
- {
- tempArray[i] = array[i + 1];
- }
- array = tempArray;
- return array;
- }
- static void FindDataSurname(string[] fullNames, string[] job, string surname)
- {
- bool isFind = false;
- for (int i = 0; i < fullNames.Length; i++)
- {
- if (surname == fullNames[i].ToLower())
- {
- Console.WriteLine($"{fullNames[i]} - {job[i]}");
- isFind = true;
- break;
- }
- }
- if (isFind == false)
- {
- Console.WriteLine("Такого человека нет.");
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement