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 ConsoleApp16
- {
- class Program
- {
- static void Main(string[] args)
- {
- string[] weaponName = { " Винтовка Гаусса", " BFG", " Нож" };
- int[] weaponAttackPower = { 100, 150, 10 };
- int[] weaponShootingSpeed = { 10, 4, 0 };
- string equippedWeapon = "";
- bool isInventoryFull = false;
- while (true)
- {
- Console.WriteLine();
- Console.WriteLine("Введите команду: \n1. Вывод статистики оружия \n2. Экипировать оружие \n3. Добавить оружие ");
- int userComandNumberInput = Convert.ToInt32(Console.ReadLine());
- switch (userComandNumberInput)
- {
- case 1:
- Console.WriteLine("Статистику какого оружия вы хотите узнать?");
- for (int i = 0; i < weaponName.Length; i++)
- {
- Console.WriteLine((i + 1) + "."+ weaponName[i]);
- }
- userComandNumberInput = Convert.ToInt32(Console.ReadLine());
- switch (userComandNumberInput)
- {
- case 1:
- Console.WriteLine("\nВинтовка Гаусса Урон: " + weaponAttackPower[0] + "\n Скорострельность: " + weaponShootingSpeed[0] + " выстрелов в минуту");
- break;
- case 2:
- Console.WriteLine("\n BFG Урон: " + weaponAttackPower[1] + "\n Скорострельность: " + weaponShootingSpeed[1] + " выстрела в минуту");
- break;
- case 3:
- Console.WriteLine("\n Нож Урон: " + weaponAttackPower[2] + "\n Скорострельность: " + weaponShootingSpeed[2] + " выстрелов в минуту");
- break;
- default:
- Console.WriteLine(weaponName[weaponName.Length - 1] + "\n Урон: "
- + weaponAttackPower[weaponAttackPower.Length - 1]
- + "\n Скорострельность: " + weaponShootingSpeed[weaponShootingSpeed.Length - 1]);
- break;
- }
- break;
- case 2:
- Console.WriteLine("Какое оружие экипируем?");
- for (int i = 0; i < weaponName.Length; i++)
- {
- Console.WriteLine((i + 1) + "." + weaponName[i]);
- }
- userComandNumberInput = Convert.ToInt32(Console.ReadLine());
- switch (userComandNumberInput)
- {
- case 1:
- equippedWeapon = weaponName[0];
- break;
- case 2:
- equippedWeapon = weaponName[1];
- break;
- case 3:
- equippedWeapon = weaponName[2];
- break;
- default:
- equippedWeapon = weaponName[weaponName.Length-1];
- break;
- }
- Console.WriteLine("Сейчас у вас в руках: оружие номер " + equippedWeapon);
- break;
- case 3:
- if (isInventoryFull == false)
- {
- Console.WriteLine("Введите название нового оружия");
- string[] tempWeaponName = new string[weaponName.Length + 1];
- for (int i = 0; i < weaponName.Length; i++)
- {
- tempWeaponName[i] = weaponName[i];
- }
- tempWeaponName[tempWeaponName.Length - 1] = " " + Console.ReadLine();
- weaponName = tempWeaponName;
- Console.WriteLine("Какой урон у оружия?");
- int[] tempWeaponAttackPower = new int[weaponAttackPower.Length + 1];
- for (int i = 0; i < weaponAttackPower.Length; i++)
- {
- tempWeaponAttackPower[i] = weaponAttackPower[i];
- }
- tempWeaponAttackPower[tempWeaponAttackPower.Length - 1] = Convert.ToInt32(Console.ReadLine());
- weaponAttackPower = tempWeaponAttackPower;
- Console.WriteLine("Какая скорострельность у оружия?");
- int[] tempWeaponShootingSpeed = new int[weaponShootingSpeed.Length + 1];
- for (int i = 0; i < weaponShootingSpeed.Length; i++)
- {
- tempWeaponShootingSpeed[i] = weaponShootingSpeed[i];
- }
- tempWeaponShootingSpeed[tempWeaponShootingSpeed.Length - 1] = Convert.ToInt32(Console.ReadLine());
- weaponShootingSpeed = tempWeaponShootingSpeed;
- isInventoryFull = true;
- }
- else
- {
- Console.WriteLine("Ошибка! Инвентарь полон!");
- }
- break;
- }
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment