public static void Main(string[] args) { ISoftUniList <string> softUniList = new SoftUniList <string>(); string input = Console.ReadLine(); while (input != "END") { string[] inputArgs = input.Split(); string command = inputArgs[0]; string element = ""; switch (command) { case "Add": element = inputArgs[1]; softUniList.Add(element); break; case "Remove": int index = int.Parse(inputArgs[1]); softUniList.Remove(index); break; case "Contains": element = inputArgs[1]; Console.WriteLine(softUniList.Contains(element)); break; case "Swap": int firstIndex = int.Parse(inputArgs[1]); int secondIndex = int.Parse(inputArgs[2]); softUniList.Swap(firstIndex, secondIndex); break; case "Greater": element = inputArgs[1]; Console.WriteLine(softUniList.CountGreaterThan(element)); break; case "Max": Console.WriteLine(softUniList.Max()); break; case "Min": Console.WriteLine(softUniList.Min()); break; case "Print": Console.WriteLine(softUniList); break; } input = Console.ReadLine(); } }
public static void Main() { ISoftUniList <string> softUniList = new SoftUniList <string>(); string input = Console.ReadLine(); while (input != "END") { string[] inputArgs = input.Split(); string command = inputArgs[0]; switch (command) { case "Add": softUniList.Add(inputArgs[1]); break; case "Remove": softUniList.Remove(int.Parse(inputArgs[1])); break; case "Contains": Console.WriteLine(softUniList.Contains(inputArgs[1])); break; case "Swap": softUniList.Swap(int.Parse(inputArgs[1]), int.Parse(inputArgs[2])); break; case "Greater": Console.WriteLine(softUniList.CountGreaterThan(inputArgs[1])); break; case "Max": Console.WriteLine(softUniList.Max()); break; case "Min": Console.WriteLine(softUniList.Min()); break; case "Print": Console.WriteLine(softUniList); break; default: throw new ArgumentException(); } input = Console.ReadLine(); } }
static void Main(string[] args) { int[] array = new int[5]; SoftUniList <int> list = new SoftUniList <int>(); list.Add(5); list.Add(6); list.Add(7); Console.WriteLine(list.Get(0)); Console.WriteLine(list.Get(1)); Console.WriteLine(list.Get(2)); //foreach (var item in list) //{ // Console.WriteLine(item); //} }
public static void Main(string[] args) { SoftUniList <string> softUniList = new SoftUniList <string>(); softUniList.Add("Gosho"); softUniList.Add("Pesho"); softUniList.Add("Ivan"); softUniList.Remove("Iv12314214an"); foreach (var item in softUniList) { Console.WriteLine(item); } Console.WriteLine("-----"); softUniList[0] = "Pavel"; for (int i = 0; i < softUniList.Count; i++) { Console.WriteLine(softUniList[i]); } }
public static void Main(string[] args) { SoftUniList <string> softUniList = new SoftUniList <string>(); }