Example #1
0
        static void Main(string[] args)
        {
            IIndexableSeries arProgression = new ArithmeticalProgression(2, 2);

            Console.Write("Arithmetical Progression: ");
            PrintSeries(arProgression);
            Console.WriteLine();
            Console.WriteLine(arProgression[2]);

            IIndexableSeries list = new List(new double[] { 5, 8, 6, 3, 1 });

            Console.Write("List: ");
            PrintSeries(list);
            Console.WriteLine();
            Console.WriteLine(list[2]);

            IIndexableSeries geoProgression = new GeometricalProgression(2, 2);

            Console.Write("Geometrical Progression: ");
            PrintSeries(geoProgression);
            Console.WriteLine();
            Console.WriteLine(geoProgression[2]);

            Console.ReadKey();
        }
Example #2
0
        static void Main(string[] args)
        {
            ISeries progression = new ArithmeticalProgression(2, 2);

            PrintSeries(progression);
            Console.WriteLine(progression[1].ToString());
            Console.ReadLine();
        }
Example #3
0
        static void Main(string[] args)
        {
            var progression = new ArithmeticalProgression(5, 3);
            var list        = new List(new double[] { 7.0, 3.0, 2.0, 13.0, 5.0, 2.0, 35.0, 11.0, 3.0, 9.0, 47.0 });

            Console.WriteLine(GetDemoResult(progression));
            Console.WriteLine(GetDemoResult(list));

            Console.ReadKey();
        }
Example #4
0
        static void Main(string[] args)
        {
            double[]   array = { 1, 4, 3, 1, 6, 7, 3, 2 };
            IIndexable list  = new List(array);

            Console.WriteLine($"{list.GetType().Name}: {PrintSeries(list)}");
            IIndexable arithmeticalProgression = new ArithmeticalProgression(2, 3, 10);

            Console.WriteLine($"{arithmeticalProgression.GetType().Name}: {PrintSeries(arithmeticalProgression)}");
            Console.ReadLine();
        }
        public static void DemoMain(string[] args)
        {
            ISeries progression = new ArithmeticalProgression(2, 2);

            Console.WriteLine("Progression:");
            PrintSeries(progression);

            ISeries list = new List(new double[] { 5, 8, 6, 3, 1 });

            Console.WriteLine("List:");
            PrintSeries(list);
        }
Example #6
0
        static void Main(string[] args)
        {
            IIndexable progression = new ArithmeticalProgression(2, 2);

            Console.WriteLine("Progression:");
            PrintIndex(progression, 29);

            IIndexable list = new List(new double[] { 5, 8, 6, 3, 1 });

            Console.WriteLine("List:");
            PrintIndex(list, 3);
            Console.ReadKey();
        }
Example #7
0
        static void Main(string[] args)
        {
            ArithmeticalProgression arithmeticalProgression = new ArithmeticalProgression(2, 2);

            PrintSeries(arithmeticalProgression, 5);

            double[] series = new double[] { 1, 2, 3, 4, 5, 6, 7 };
            List     list   = new List(series);

            PrintSeries(list, 5);

            Console.ReadKey();
        }
Example #8
0
        static void Main(string[] args)
        {
            ISeries progression = new ArithmeticalProgression(2, 2);

            Console.WriteLine("Progression:");
            PrintSeries(progression);
            ISeries list = new List(new double[] { 1, 2, 3, 4, 5, 6, 7, 8, 9, 5421.5 });

            Console.WriteLine();
            Console.WriteLine("List:");
            PrintSeries(list);
            Console.ReadLine();
        }
Example #9
0
        static void Main(string[] args)
        {
            IIndexableSeries progression = new ArithmeticalProgression(2, 2);

            Console.WriteLine("Progression:");
            PrintSeries(progression);

            IIndexableSeries list = new List(new double[] { 5, 8, 6, 3, 1, 5, 6, 8, 6, 9, 33 });

            Console.WriteLine("List:");
            PrintSeries(list);
            Console.ReadKey();
        }
Example #10
0
        static void Main(string[] args)
        {
            double[] array = new double[] { 5, 3, 1, 10, 6, 1, 9, 7, 12 };
            List     list  = new List(array);

            PrintList(list, array.Length);

            ArithmeticalProgression progression = new ArithmeticalProgression(2, 4);

            PrintList(progression, 5);

            Console.ReadKey();
        }
Example #11
0
        static void Main(string[] args)
        {
            ArithmeticalProgression progression = new ArithmeticalProgression(2, 2);

            Console.WriteLine("Progression:");
            PrintSeries(progression);
            List list = new List(new double[] { 1, 5, 8, 11, 12, 6, 8 });

            Console.WriteLine("List:");
            PrintSeries(list);
            Console.WriteLine("Progression by index:");
            PrintElementByIndex(progression, 4);
            Console.WriteLine("List by index");
            PrintElementByIndex(list, 5);
        }
        static void Main(string[] args)
        {
            Console.WriteLine("Арифметическая прогрессия start = {0}, step = {1}:", 0.0, 1.0);
            ArithmeticalProgression progression = new ArithmeticalProgression(0.0, 1.0);

            PrintSeries(progression);

            Console.WriteLine();

            Console.WriteLine("Структура \"List\" реализующая интерфейс \"IIndexableSeries\" ");
            List list = new List(new double[] { 1.0, 2.0, 3.0, 4.0 });

            PrintSeries(list);

            Console.ReadKey();
        }
        static void Main(string[] args)
        {
            ArithmeticalProgression progression = new ArithmeticalProgression(2, 2);

            Console.WriteLine("Progression(Series):");
            PrintSeries(progression);
            Console.WriteLine("Progression(IIndexable):");
            PrintIIndex(progression);

            List list = new List(new double[] { 5, 8, 6, 3, 1 });

            Console.WriteLine("List(Series):");
            PrintSeries(list);
            Console.WriteLine("List(Indexable):");
            PrintIIndex(list);
        }
Example #14
0
        static void Main(string[] args)
        {
            ISeries    progression  = new ArithmeticalProgression(2, 2);
            IIndexable progression2 = new ArithmeticalProgression(2, 2);

            Console.WriteLine("Progression:");
            PrintSeries(progression);

            ISeries    list  = new List(new double[] { 5, 8, 6, 3, 1 });
            IIndexable list2 = new List(new double[] { 5, 8, 6, 3, 1 });
            var        a     = new int[] { 6, 8 };
            var        s     = a[2];

            Console.WriteLine("List:");
            PrintSeries(list);
        }
Example #15
0
        static void Main()
        {
            IIndexableSeries progression = new ArithmeticalProgression(2, 2);

            Console.WriteLine("Progression:");
            PrintSeries(progression);
            Console.WriteLine("Index 1: ");
            PrintIndex(progression, 1);

            IIndexableSeries list = new List(new double[] { 5, 8, 6, 3, 1 });

            Console.WriteLine("List:");
            PrintSeries(list);
            Console.WriteLine("Index 2: ");
            PrintIndex(list, 2);
            Console.ReadKey();
        }
Example #16
0
        public static void Main(string[] args)
        {
            var progression = new ArithmeticalProgression(2, 2);

            Console.WriteLine("Progression:");
            PrintSeries(progression);
            Console.WriteLine("Element with index 3");
            Console.WriteLine(progression[3]);


            var list = new List(new double[] { 5, 8, 6, 3, 1 });

            Console.WriteLine("List:");
            PrintSeries(list);
            Console.WriteLine("Element with index 2");
            Console.WriteLine(list[2]);

            Console.ReadKey();
        }
Example #17
0
        static void Main(string[] args)
        {
            Console.Write("Enter [index] to show element of arithmetical progression(2,2) and reapiting list(5,8,6,3,1):\t");
            int index = int.Parse(Console.ReadLine());
            ArithmeticalProgression progression = new ArithmeticalProgression(2, 2);
            List list = new List(new double[] { 5, 8, 6, 3, 1 });

            double a = progression.GetNumberByIndex(index);

            Console.WriteLine($"[{index}] element of progression - {a}");
            double b = list.GetNumberByIndex(index);

            Console.WriteLine($"[{index}] element of list - {b}");



            Console.WriteLine("\n\nEnd of program. Press any key.");
            Console.ReadKey();
        }
        static void Main(string[] args)
        {
            ArithmeticalProgression myArithmeticalProgression1 = new ArithmeticalProgression(1, 2);

            PrintSeries(myArithmeticalProgression1);
            Console.ReadKey();
            Console.WriteLine();
            Console.WriteLine($"Элемент №5 : ");
            Console.WriteLine(GetElement(myArithmeticalProgression1, 5));
            Console.ReadKey();

            double[] myArray = new double[10] {
                1, 2, 3, 4, 5, 6, 7, 8, 9, 10
            };
            List myList1 = new List(myArray);

            PrintSeries(myList1);
            Console.ReadKey();
            Console.WriteLine();
            Console.WriteLine($"Элемент №5 : ");
            Console.WriteLine(GetElement(myList1, 5));
            Console.ReadKey();
        }
Example #19
0
        static void Main(string[] args)
        {
            IIndexableSeries progression = new ArithmeticalProgression(2, 2);

            Console.WriteLine("Progression:");
            PrintSeries(progression);

            try
            {
                AccessByIndex(progression, 5);
                AccessByIndex(progression, -3);
            }
            catch (ArgumentOutOfRangeException ex)
            {
                Console.WriteLine(ex.Message);
            }

            Console.WriteLine();
            IIndexableSeries list = new List(new double[] { 5, 8, 6, 3, 1 });

            Console.WriteLine("List:");
            PrintSeries(list);

            try
            {
                AccessByIndex(list, 2);
                AccessByIndex(list, 8);
                AccessByIndex(list, 21);
                AccessByIndex(list, -3);
            }
            catch (ArgumentOutOfRangeException ex)
            {
                Console.WriteLine(ex.Message);
            }

            Console.ReadKey();
        }
Example #20
0
        static void Main(string[] args)
        {
            IIndexableSeries progression = new ArithmeticalProgression(2, 2);

            Console.WriteLine(progression[5]);
        }