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 Кадровый_учет
- {
- class Program
- {
- static void Main(string[] args)
- {
- string[] Surname = new string[0];
- string[] Profession = new string[0];
- do
- {
- Console.Clear();
- Console.WriteLine("1 - Добавить досье\n2 - Вывести всё досье\n3 - Удалить досье\n4 - Выход\n");
- int N = Convert.ToInt32(Console.ReadLine());
- switch (N)
- {
- case 1:
- Console.Clear();
- Console.WriteLine("Добавление досье\n");
- Console.WriteLine("Введите новую фамилию\n");
- string NewSurname = Console.ReadLine();
- string[] NresultS = new string[Surname.Length + 1];
- for (int i = 0; i < Surname.Length; i++)
- {
- NresultS[i] = Surname[i];
- }
- NresultS[NresultS.Length - 1] = NewSurname.ToUpper();
- Surname = NresultS;
- //for (int i = 0; i < Surname.Length; i++)
- //{
- // Console.WriteLine(Surname[i]);
- //}
- Console.WriteLine();
- Console.WriteLine("Введите новую профессию\n");
- string NewProfession = Console.ReadLine();
- string[] NresultP = new string[Profession.Length + 1];
- for (int i = 0; i < Profession.Length; i++)
- {
- NresultP[i] = Profession[i];
- }
- NresultP[NresultP.Length - 1] = NewProfession.ToUpper();
- Profession = NresultP;
- //for (int i = 0; i < Profession.Length; i++)
- //{
- //Console.WriteLine(Profession[i]);
- //}
- Console.WriteLine();
- Console.WriteLine("Досье добавлено");
- Console.ReadKey();
- break;
- case 2:
- Console.Clear();
- Console.WriteLine("Вывод всех досье\n");
- for (int i = 0; i < Surname.Length; i++)
- {
- Console.WriteLine(Surname[i]+" - "+ Profession[i]);
- }
- Console.ReadKey();
- break;
- case 3:
- Console.Clear();
- Console.WriteLine("Удаление досье\n");
- int newLength = Surname.Length;
- if (newLength < 1)
- {
- Console.WriteLine("Список досье пуст\n");
- }
- else
- {
- Console.WriteLine("Введите фамилию\n");
- string OldSurname = Console.ReadLine();
- string[] OresultS = new string[newLength];
- string[] OresultP = new string[newLength];
- int newCounter = 0;
- for (int i = 0; i < Surname.Length; i++)
- {
- if (Surname[i] == OldSurname.ToUpper())
- {
- continue;
- }
- else
- {
- OresultP[newCounter] = Profession[i];
- OresultS[newCounter] = Surname[i];
- newCounter += 1;
- }
- }
- Surname = OresultS;
- Profession = OresultP;
- }
- Console.WriteLine();
- Console.WriteLine("Досье удалено");
- Console.ReadKey();
- break;
- case 4:
- Console.Clear();
- Console.WriteLine("Выход");
- Console.ReadKey();
- return;
- default:
- Console.Clear();
- Console.WriteLine("Ошибка");
- Console.ReadKey();
- break;
- }
- } while (true);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement