Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- namespace Clight_15_HumanUchet
- {
- class Program
- {
- static void Main(string[] args)
- {
- bool isWork = true;
- string tempFio;
- string tempJob;
- int numMenu;
- string[] fioDosie = new string[0];
- string[] jobDosie = new string[0];
- while (isWork == true)
- {
- Console.WriteLine("Меню кадрового учёта:");
- Console.WriteLine("1 - Добавить досье");
- Console.WriteLine("2 - Вывести досье");
- Console.WriteLine("3 - Удалить досье");
- Console.WriteLine("4 - Поиск по фамилии");
- Console.WriteLine("5 - Выход");
- Console.Write("\nВведите номер меню: ");
- numMenu = Convert.ToInt32(Console.ReadLine());
- switch (numMenu)
- {
- case 1:
- Console.SetCursorPosition(0, 9);
- Console.Write("Введите фамилию сотрудника: ");
- tempFio = Console.ReadLine();
- Console.Write("Введите должность сотрудника: ");
- tempJob = Console.ReadLine();
- fioDosie = AddDosie(fioDosie, tempFio);
- jobDosie = AddDosie(jobDosie, tempJob);
- break;
- case 2:
- Console.SetCursorPosition(0, 9);
- ViewDosie(fioDosie, jobDosie);
- break;
- case 3:
- fioDosie = new string[0];
- jobDosie = new string[0];
- Console.SetCursorPosition(0, 9);
- Console.WriteLine("Досье сотрудников удалено.");
- Console.ReadKey();
- break;
- case 4:
- Console.SetCursorPosition(0, 9);
- FindWorker(fioDosie, jobDosie);
- break;
- case 5:
- isWork = false;
- break;
- }
- Console.Clear();
- }
- Console.WriteLine("До свидания!");
- Console.ReadKey();
- static string[] AddDosie(string[] currentMassive, string temp)
- {
- string[] tempMassive = new string[currentMassive.Length + 1];
- for (int i = 0; i < currentMassive.Length; i++)
- {
- tempMassive[i] = currentMassive[i];
- }
- tempMassive[tempMassive.Length - 1] = temp;
- return currentMassive = tempMassive;
- }
- static void ViewDosie(string[] fioDosie, string[] jobDosie)
- {
- Console.WriteLine("Досье сотрудников:");
- for (int i = 0; i < fioDosie.Length; i++)
- {
- Console.WriteLine($"{i + 1}. {fioDosie[i]} - {jobDosie[i]}");
- }
- Console.ReadKey();
- }
- static void FindWorker(string[] fioDosie, string[] jobDosie)
- {
- Console.Write("Введите фамилию: ");
- string fioFind = Console.ReadLine();
- Console.WriteLine("\nНайдены сотрудники: \n");
- int j = 0;
- for (int i = 0; i < fioDosie.Length; i++)
- {
- if (fioDosie[i] == fioFind)
- {
- Console.WriteLine($"{i + 1}. {fioDosie[i]} - {jobDosie[i]}");
- j++;
- }
- }
- if (j == 0)
- {
- Console.WriteLine($"Сотрудников с фамилией {fioFind} не найдено.");
- }
- Console.ReadKey();
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement