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 FifthProject
- {
- class Program
- {
- static void Main(string[] args)
- {
- int menu;
- int num = 0;
- int equipped;
- string[] weapon = new string[1];
- int[] damage = new int[1];
- int[] ammo = new int[1];
- string[] tempWeapon = new string[0];
- int[] tempDamage = new int[0];
- int[] tempAmmo = new int[0];
- while (true)
- {
- if (ammo[num] != 0)
- {
- Console.WriteLine($"Экипированно: {weapon[num]}\n" +
- $"Урон: {damage[num]}\n" +
- $"Размер магазина: {ammo[num]}\n");
- }
- Console.WriteLine("\tМеню\n" +
- "1. Добавить оружие.\n" +
- "2. Удалить оружие.\n" +
- "3. Экипировать оружие.");
- menu = Convert.ToInt32(Console.ReadLine());
- switch (menu)
- {
- case 1:
- Console.Write("Введите название для оружия: ");
- weapon[num] = Console.ReadLine();
- Console.Write("Введите его урон: ");
- damage[num] = Convert.ToInt32(Console.ReadLine());
- Console.Write("Введите размер магазина: ");
- ammo[num] = Convert.ToInt32(Console.ReadLine());
- tempWeapon = new string[weapon.Length + 1];
- tempWeapon[num] = weapon[num];
- weapon = tempWeapon;
- tempDamage = new int[damage.Length + 1];
- tempDamage[num] = damage[num];
- damage = tempDamage;
- tempAmmo = new int[ammo.Length + 1];
- tempAmmo[num] = ammo[num];
- ammo = tempAmmo;
- num++;
- break;
- case 2:
- Console.WriteLine("Какое оружие удалить?");
- for (int i = 0; i < weapon.Length - 1; i++)
- {
- Console.WriteLine($"Оружие номер {i + 1}: {weapon[i]}\n");
- }
- menu = Convert.ToInt32(Console.ReadLine());
- weapon[menu - 1] = null;
- int j = 0;
- tempWeapon = new string[weapon.Length];
- tempDamage = new int[weapon.Length];
- tempAmmo = new int[weapon.Length];
- for (int i = 0; i < weapon.Length; i++)
- {
- if (weapon[j] == null)
- {
- j++;
- }
- tempWeapon[i] = weapon[j];
- tempDamage[i] = damage[j];
- tempAmmo[i] = ammo[j];
- j++;
- }
- weapon = tempWeapon;
- damage = tempDamage;
- ammo = tempAmmo;
- break;
- case 3:
- Console.WriteLine("Какое оружие экипировать?");
- for (int i = 0; i < weapon.Length - 1; i++)
- {
- Console.WriteLine($"Оружие номер {i + 1}: {weapon[i]}\n");
- }
- equipped = Convert.ToInt32(Console.ReadLine());
- break;
- default:
- Console.WriteLine("Не верная команда");
- break;
- }
- // Console.Clear();
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement