コード例 #1
0
ファイル: Program.cs プロジェクト: SalamanderSunburn/ValTech
        static void Main(string[] args)
        {
            AList2 arr0 = new AList2();
            int[] array = { 10, 1, 2, 5, 8 };

            arr0.Init(array);
            arr0.Output();

            Console.WriteLine("Min = " + arr0.Min());
            Console.WriteLine("Min index = " + arr0.MinIndex());
            Console.WriteLine("Max = " + arr0.Max());
            Console.WriteLine("Max index = " + arr0.MaxIndex());
            Console.WriteLine("__________________________________");

            arr0.AddStart(2);
            arr0.AddEnd(7);
            arr0.AddPos(20, 1);
            arr0.Output();
            Console.WriteLine("__________________________________");

            arr0.DelStart();
            arr0.DelEnd();
            arr0.DelPos(2);
            arr0.Output();
            Console.WriteLine("__________________________________");

            arr0.Reverse();
            arr0.Output();
            Console.WriteLine("__________________________________");
            arr0.HalfReverse();
            arr0.Output();
            Console.WriteLine("__________________________________");

            Console.WriteLine("Index = 2: " + arr0.Get(2));
            Console.WriteLine("__________________________________");
            arr0.Set(-78, 3);
            arr0.Output();
            Console.WriteLine("__________________________________");
            arr0.Sort();
            arr0.Output();
            Console.WriteLine("__________________________________");
            arr0.Clear();
            arr0.Output();

            Console.ReadLine();
        }
コード例 #2
0
ファイル: AListTest.cs プロジェクト: MGnuskina/Tasks
 public void AListHalfReverseOdd36Test()
 {
     var a = new AList2();
     int[] mas = new int[36] { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36 };
     a.Init(mas);
     a.HalfReverse();
     int size = a.Size();
     mas = new int[36] { 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18 };
     Assert.AreEqual(36, size);
     CollectionAssert.AreEqual(mas, a.ToArray());
 }