Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Diagnostics;
- namespace FifthProject
- {
- class Program
- {
- static void Main(string[] args)
- {
- string[] weapon = new string[1];
- int[] damage = new int[1];
- int[] ammo = new int[1];
- int menu;
- int number = 0;
- int equiped = 0;
- bool outfitted = false;
- while (true)
- {
- if (outfitted)
- {
- Console.WriteLine($"Outfitted: {weapon[equiped]}\n" +
- $"Damage: {damage[equiped]}\n" +
- $"Ammo: {ammo[equiped]}\n");
- }
- Console.WriteLine($"\tMenu\n" +
- $"1. Add weapon\n" +
- $"2. Remove weapon\n" +
- $"3. Equip weapon\n");
- menu = Convert.ToInt32(Console.ReadLine());
- if (menu > 3)
- {
- Console.Clear();
- continue;
- }
- switch(menu)
- {
- case 1:
- Console.Write("Enter name: ");
- weapon[number] = Console.ReadLine();
- string[] tempWeapon = new string[weapon.Length + 1];
- Console.Write("\nEnter Damage: ");
- damage[number] = Convert.ToInt32(Console.ReadLine());
- int[] tempDamage = new int[damage.Length + 1];
- Console.Write("\nEnter the size of the magazine: ");
- ammo[number] = Convert.ToInt32(Console.ReadLine());
- int[] tempAmmo = new int[ammo.Length + 1];
- for (int i = 0; i < weapon.Length; i++)
- {
- tempWeapon[i] = weapon[i];
- }
- weapon = tempWeapon;
- for (int i = 0; i < damage.Length; i++)
- {
- tempDamage[i] = damage[i];
- }
- damage = tempDamage;
- for (int i = 0; i < ammo.Length; i++)
- {
- tempAmmo[i] = ammo[i];
- }
- ammo = tempAmmo;
- number++;
- break;
- case 2:
- Console.Write("Enter slot: \n");
- for (int i = 0; i < weapon.Length - 1; i++)
- {
- Console.WriteLine($"{i + 1}. {weapon[i]}");
- }
- int deleteMenu = Convert.ToInt32(Console.ReadLine());
- weapon[deleteMenu - 1] = null;
- string[] tempWeapon2 = new string[weapon.Length - 1];
- int[] tempDamage2 = new int[weapon.Length - 1];
- int[] tempAmmo2 = new int[ammo.Length - 1];
- for (int i = 0; i < weapon.Length - 1; i++)
- {
- if (weapon[i] != null)
- {
- tempWeapon2[i] = weapon[i];
- tempDamage2[i] = damage[i];
- tempAmmo2[i] = ammo[i];
- }
- else
- {
- tempWeapon2[i] = weapon[i+1];
- tempDamage2[i] = damage[i+1];
- tempAmmo2[i] = ammo[i+1];
- }
- }
- weapon = tempWeapon2;
- damage = tempDamage2;
- ammo = tempAmmo2;
- number--;
- break;
- case 3:
- Console.WriteLine("Select a slot");
- for (int i = 0; i < weapon.Length - 1; i++)
- {
- Console.WriteLine($"{i + 1}. {weapon[i]}");
- }
- equiped = Convert.ToInt32(Console.ReadLine()) - 1;
- if (equiped >= weapon.Length - 1)
- {
- equiped = 0;
- }
- break;
- }
- if (weapon.Length == 0)
- {
- outfitted = false;
- }
- else
- {
- outfitted = true;
- }
- Console.Clear();
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement