Esempio n. 1
0
        static void Main()
        {
            double selection;

            do
            {
                Console.WriteLine("3,1 LOST.");
                Console.WriteLine("3,2 WORD FREQUENCY.");
                Console.WriteLine("3,3 DYNAMIC ARRAY AND HARDCORE MODE.");
                Console.WriteLine("3,4 CYCLED ARRAY.");
                Console.WriteLine("0 Exit.");
                Console.WriteLine();
                if (double.TryParse(Console.ReadLine(), out selection))
                {
                    switch (selection)
                    {
                    case 3.1:
                        Lost.Read();
                        break;

                    case 3.2:
                        var txt = WordFrequency.Read();
                        Dictionary <string, int> result = WordFrequency.WordFrequence(txt);
                        WordFrequency.Show(result);
                        break;

                    case 3.3:

                        DynamicArray <int> .Show();

                        Console.WriteLine();
                        DynamicArrayHardcoreMode <int> .ShowHM();

                        break;

                    case 3.4:
                        var vs = new CycledDynamicArray <int>(new List <int> {
                            1, 2, 3, 4, 5
                        }, 5);
                        foreach (var item in vs)
                        {
                            Console.WriteLine(item);
                        }
                        break;

                    case 0:
                        break;
                    }
                }
            } while (selection != 0);
        }
Esempio n. 2
0
        static void Main(string[] args)
        {
            Console.InputEncoding  = Encoding.Unicode;
            Console.OutputEncoding = Encoding.Unicode;

            int[] mas = { 0, 1, 2, 3 };
            DynamicArray <string> dArr1 = new DynamicArray <string>();
            DynamicArray <int>    dArr2 = new DynamicArray <int>(10);
            DynamicArray <int>    dArr3 = new DynamicArray <int>(mas);

            dArr1.Add("first");
            dArr1.Add("second");
            dArr1.Add("third");
            dArr1.Insert(1, "newSecond");
            dArr1.Remove("first");

            dArr2.AddRange(mas);

            dArr1.Show();
            dArr2.Show();
            dArr3.Show();

            Console.ReadKey();
        }