Advertisement
Guest User

Untitled

a guest
Oct 16th, 2019
129
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 4.71 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6.  
  7. namespace ConsoleApp1
  8. {
  9.     class Program
  10.     {
  11.         static void Main(string[] args)
  12.         {
  13.             string[] weapon = new string[4];
  14.             weapon[0] = "калаш";
  15.             weapon[1] = "панцирь";
  16.             weapon[2] = "электроудочка";
  17.             weapon[3] = "дробь";
  18.  
  19.             int[] damage = new int[4];
  20.             damage[0] = 30;
  21.             damage[1] = 69;
  22.             damage[2] = 40;
  23.             damage[3] = 100;
  24.  
  25.             int[] rateOfFire = new int[4];
  26.             rateOfFire[0] = 20;
  27.             rateOfFire[1] = 80;
  28.             rateOfFire[2] = 60;
  29.             rateOfFire[3] = 10;
  30.  
  31.             string userInput = null;
  32.             int menu;
  33.             bool play = true;
  34.  
  35.             Console.WriteLine("Экипировано: " + weapon[0]);
  36.             Console.WriteLine("Урон: " + damage[0]);
  37.             Console.WriteLine("Cкорострельность: " + rateOfFire[0]);
  38.            
  39.             Console.SetCursorPosition(10, 6);
  40.             Console.WriteLine("Меню");
  41.             Console.WriteLine("1. Добавить оружие");
  42.             Console.WriteLine("2. Удалить оружие ");
  43.             Console.WriteLine("3. Экипировать оружие");
  44.             Console.WriteLine("4. Выход");
  45.             while (play == true)
  46.             {
  47.                 menu = Convert.ToInt32(Console.ReadLine());
  48.                 switch (menu)
  49.                 {
  50.                     case 1:
  51.                         Console.WriteLine("Введите название:");
  52.                         userInput = Console.ReadLine().ToLower();
  53.                         string[] templist = new string[weapon.Length + 1];
  54.                         for (int j = 0; j < weapon.Length; j++)
  55.                         {
  56.                             templist[j] = weapon[j];
  57.                         }
  58.                         templist[templist.Length - 1] = userInput;
  59.                         weapon = templist;
  60.  
  61.                         Console.WriteLine("Укажите Урон:");
  62.                         int userInp = Convert.ToInt32(Console.ReadLine());
  63.                         int[] tempdamage = new int[damage.Length + 1];
  64.                         for (int j = 0; j < damage.Length; j++)
  65.                         {
  66.                             tempdamage[j] = damage[j];
  67.                         }
  68.                         tempdamage[tempdamage.Length - 1] = userInp;
  69.                         damage = tempdamage;
  70.                         Console.WriteLine("Укажите Cкорострельность: ");
  71.                         int userIn = Convert.ToInt32(Console.ReadLine());
  72.                         int[] tempRateOfFire = new int[rateOfFire.Length + 1];
  73.                         for (int j = 0; j < rateOfFire.Length; j++)
  74.                         {
  75.                             tempRateOfFire[j] = rateOfFire[j];
  76.                         }
  77.                         tempRateOfFire[tempRateOfFire.Length - 1] = userIn;
  78.                         rateOfFire = tempRateOfFire;
  79.                         break;
  80.                     case 2:
  81.                         Console.WriteLine("Введите название:");
  82.                         userInput = Console.ReadLine().ToLower();
  83.                         string[] tempweapon = new string[weapon.Length - 1];
  84.                         for (int j = 0; j < weapon.Length; j++)
  85.                         {
  86.                             tempweapon[j] = weapon[j];
  87.                         }
  88.                         tempweapon[tempweapon.Length] = userInput;
  89.                         weapon = tempweapon;
  90.                         break;
  91.                     case 3:
  92.                         Console.WriteLine("Выбирете оружие для экипировки: ");
  93.                         for (int i = 0; i < weapon.Length; i++)
  94.                         {
  95.                             Console.WriteLine(weapon[i]);
  96.                         }
  97.                         int answer = Convert.ToInt32(Console.ReadLine());
  98.                         Console.WriteLine("Экипировано: " + weapon[answer - 1]);
  99.                         Console.WriteLine("Урон - " + damage[answer - 1]);
  100.                         Console.WriteLine("Скорострельность " + rateOfFire[answer - 1]);
  101.                         break;
  102.                     case 4:
  103.                         Console.WriteLine("Удачи вам,возвращайтесь");
  104.                         play = false;
  105.                         break;
  106.                 }
  107.             }
  108.             Console.ReadLine();
  109.         }
  110.     }
  111. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement