Program.cs - using using using using using System System.Collections.Generic System.Linq System.Text System.Threading.Tasks namespace

Program.cs - using using using using using System...

This preview shows page 1 - 4 out of 4 pages.

using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace работа_с_масиви { class Program { static void Main(string[] args) { //obrabotka na masiv /*var arr = Console.ReadLine().Split(' ').ToArray(); int n = int.Parse(Console.ReadLine()); while (n>0) { var command = Console.ReadLine().Split(' ').ToArray(); switch (command[0]) { case "Reverse": arr = arr.Reverse().ToArray();break; case "Distinct": arr = arr.Distinct().ToArray();break; case "Replace": arr[int.Parse(command[1])] = command[2]; break; } n--; } Console.WriteLine(string.Join(" ", arr));*/ //bezopasna obrabotka na masivi /*var arr = Console.ReadLine().Split(' ').ToArray(); while (true) { var command = Console.ReadLine().Split(' ').ToArray(); switch (command[0]) { case "Reverse": arr = arr.Reverse().ToArray(); break; case "Distinct": arr = arr.Distinct().ToArray(); break; case "Replace": int index = int.Parse(command[1]); if (index < 0 || index >= arr.Length) Console.WriteLine("Invalid input!"); else arr[index] = command[2]; break; default: Console.WriteLine("Invalid input!"); break; case "END": Console.WriteLine(string.Join(" ", arr)); return;*/ // sumirane /*int n = int.Parse(Console.ReadLine()); int k = int.Parse(Console.ReadLine());
Image of page 1
Image of page 2
Image of page 3
Image of page 4

You've reached the end of your free preview.

Want to read all 4 pages?

  • Spring '18
  • Void type, int n

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture

Stuck? We have tutors online 24/7 who can help you get unstuck.
A+ icon
Ask Expert Tutors You can ask You can ask You can ask (will expire )
Answers in as fast as 15 minutes