Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- namespace IMJunior
- {
- class Program
- {
- static void Main(string[] args)
- {
- string[] ekip = new string[0];
- string[] uron = new string[0];
- string[] skor = new string[0];
- while (true)
- {
- //Вывод всего арсенала:
- Console.WriteLine("Арсенал");
- Console.Write("Экипировано: \n");
- for (int i = 0; i < ekip.Length; i++)
- Console.WriteLine(i + 1 + ") " + ekip[i]);
- Console.Write("Урон - \n");
- for (int i = 0; i < ekip.Length; i++)
- Console.WriteLine(i + 1 + ") " + uron[i]);
- Console.Write("Скорострельность - \n");
- for (int i = 0; i < ekip.Length; i++)
- Console.WriteLine(i + 1 + ") " + skor[i] + " ");
- //Меню:
- Console.WriteLine("Меню\n1) Добавить оружие\n2) Экипировать оружие\n3) Удалить оружие");
- string sw = Console.ReadLine();
- switch (sw)
- {
- case "1":
- string eki = " ";
- string urn = " ";
- string skr = " ";
- Console.Write("Экипировано: ");
- eki = Console.ReadLine();
- string[] tempekip = new string[ekip.Length + 1]; //увеличение массива
- for (int i = 0; i < ekip.Length; i++)
- {
- tempekip[i] = ekip[i];
- }
- tempekip[tempekip.Length - 1] = eki;
- ekip = tempekip;
- Console.WriteLine();
- Console.Write("Урон - ");
- urn = Console.ReadLine();
- string[] tempuron = new string[uron.Length + 1]; //увеличение массива
- for (int i = 0; i < uron.Length; i++)
- {
- tempuron[i] = uron[i];
- }
- tempuron[tempuron.Length - 1] = urn;
- uron = tempuron;
- Console.WriteLine();
- Console.Write("Cкорострельность - ");
- skr = Console.ReadLine();
- string[] tempskor = new string[skor.Length + 1]; //увеличение массива
- for (int i = 0; i < skor.Length; i++)
- {
- tempskor[i] = skor[i];
- }
- tempskor[tempskor.Length - 1] = urn;
- skor = tempskor;
- Console.WriteLine();
- break;
- case "2":
- Console.Write("Введите номер оружия для экипировки: ");
- int number = Convert.ToInt32(Console.ReadLine());
- Console.WriteLine("Что вы хотите поменять: \n1) Экипировано\n2) Урон\n3) Скорострельность\n");
- string menu = Console.ReadLine();
- switch (menu)
- {
- case "1":
- Console.WriteLine("Введите название: ");
- ekip[number - 1] = Console.ReadLine();
- break;
- case "2":
- Console.WriteLine("Введите урон: ");
- ekip[number - 1] = Console.ReadLine();
- break;
- case "3":
- Console.WriteLine("Введите скорострельность: ");
- ekip[number - 1] = Console.ReadLine();
- break;
- default:
- break;
- }
- break;
- case "3":
- Console.Write("Введите номер оружия, которое хотите удалить: ");
- string numdel = Console.ReadLine();
- tempekip = new string[ekip.Length-1]; //уменьшение массива ekip
- for (int i = 0; i < tempekip.Length; i++)
- {
- if (i != Convert.ToInt32(numdel)-1) // условие непопадания в уменьшенный массив удаленного элемента
- {
- tempekip[i] = ekip[i];
- }
- }
- ekip = tempekip;
- tempuron = new string[uron.Length - 1]; //уменьшение массива uron
- for (int i = 0; i < tempuron.Length; i++)
- {
- if (i != Convert.ToInt32(numdel) - 1) // условие непопадания в уменьшенный массив удаленного элемента
- {
- tempuron[i] = uron[i];
- }
- }
- uron = tempuron;
- tempskor = new string[skor.Length - 1]; //уменьшение массива skor
- for (int i = 0; i < tempskor.Length; i++)
- {
- if (i != Convert.ToInt32(numdel) - 1) //условие непопадания в уменьшенный массив удаленного элемента
- {
- tempskor[i] = skor[i];
- }
- }
- skor = tempskor;
- break;
- default:
- break;
- }
- Console.Clear();
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment