AlexRaynor

4.6 Arsenal

Sep 22nd, 2019
152
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.61 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 ConsoleApp19
  8. {
  9.     class Program
  10.     {
  11.         static void Main(string[] args)
  12.         {
  13.             string[] Guns = { "BFG", "Калаш", "Дробаш" };
  14.             string[] Ammo = { "Лазерные плюхи", "7.62", "Дробь" };
  15.  
  16.             ReplaceArray(Guns, Ammo);
  17.  
  18.             for (int i = 0; i < Guns.Length; i++)
  19.             {
  20.                 Console.WriteLine(Guns[i]);
  21.             }
  22.  
  23.         }
  24.  
  25.  
  26.         static string[] ExpandArray(string[] arrays, string arrayElement)
  27.         {
  28.             string[] tempArray = new string[arrays.Length + 1];
  29.             for (int i = 0; i < arrays.Length; i++)
  30.             {
  31.                 tempArray[i] = arrays[i];
  32.             }
  33.             tempArray[tempArray.Length - 1] = " " + arrayElement;
  34.  
  35.             arrays = tempArray;
  36.  
  37.             return arrays;
  38.  
  39.  
  40.         }
  41.  
  42.  
  43.         static string[] DecreaseArray(string[] arrays)
  44.         {
  45.             string[] tempArray = new string[arrays.Length - 1];
  46.             for (int i = 0; i < (arrays.Length - 1); i++)
  47.             {
  48.                 tempArray[i] = arrays[i];
  49.             }
  50.  
  51.             arrays = tempArray;
  52.  
  53.             return arrays;
  54.  
  55.  
  56.         }
  57.  
  58.         static string[] ReplaceArray(string[] arrays, string[] arrays2)
  59.         {
  60.  
  61.             for (int i = 0; i < arrays.Length; i++)
  62.             {
  63.                 arrays[i] = arrays2[i];
  64.             }
  65.  
  66.             arrays = arrays2;
  67.  
  68.             return arrays;
  69.  
  70.  
  71.         }
  72.  
  73.     }
  74. }
Advertisement
Add Comment
Please, Sign In to add comment