예제 #1
0
        public static void Main()
        {
            int n;

            Console.WriteLine("Task 1.9 for XT_EPAM" + "\n\r--------------------");
            Console.WriteLine("Choose array type: "
                              + "\n\r1 - Array of Integer"
                              + "\n\r2 - Array of Double");
            n = InputFromConsole.IsInteger(true);
            switch (n)
            {
            case 1:
                Console.WriteLine("Enter the number of elements in the Integer array");
                n = InputFromConsole.IsInteger(true);
                int[] intArray = Arrays.CreateArray(n, n, true, true);
                Arrays.SummOfElements.IntPositiveSum(intArray, true);
                break;

            case 2:
                Console.WriteLine("Enter the number of elements in the Double array");
                n = InputFromConsole.IsInteger(true);
                double[] doubArray = Arrays.CreateDoubleArray(n, n, true, true);
                Arrays.SummOfElements.DoubPositiveSum(doubArray, true);
                break;
            }
        }
예제 #2
0
        public static void Main()
        {
            Console.WriteLine("Task 2.6 for XT_EPAM" + "\n\r--------------------");
            int    x;
            int    y;
            double innR, outR;

            Console.WriteLine("Enter X:");
            x = InputFromConsole.IsInteger();
            Console.WriteLine("Enter Y:");
            y = InputFromConsole.IsInteger();
            Console.WriteLine("Enter inner R:");
            innR = InputFromConsole.IsDouble();
            Console.WriteLine("Enter outer R:");
            outR = InputFromConsole.IsDouble();

            Point center = new Point(x, y);

            Round innerRound = new Round(center);

            innerRound.Radius = innR;
            Round outerRound = new Round(center);

            outerRound.Radius = outR;
            outerRound.GetInfo();
            innerRound.GetInfo();

            Ring myRing = new Ring(innerRound, outerRound);

            myRing.GetInfo();
        }
예제 #3
0
        public static void Main()
        {
            Console.WriteLine("Task 1.8 for XT_EPAM" + "\n\r--------------------");
            Console.WriteLine("Enter size of array: ");
            int size = InputFromConsole.IsInteger();

            int[,,] array = new int[size, size, size];
            fullAndShowCube(ref array, true);
            noPositive(ref array);
        }
예제 #4
0
        static void processingDoubleArray()
        {
            int n;

            Console.WriteLine("Enter the number of elements in the Double array");
            n = InputFromConsole.IsInteger(true);                             //считываем количество элементов
            double[] doubArray = Arrays.CreateDoubleArray(n, n, false, true); //создаем массив
            MaxElement.Max(doubArray, true);                                  //определяем и выводим максимальный элемент
            Arrays.QSort.Start(ref doubArray, 0, n - 1);                      //сортируем массив
            for (int i = 0; i < n; i++)                                       //выводим массив
            {
                Console.Write($"{doubArray[i]:F4} ");
            }
        }
예제 #5
0
        public static void Main()
        {
            int n;

            Console.WriteLine("Task 1.7 for XT_EPAM" + "\n\r--------------------");
            Console.WriteLine("Choose array type: "
                              + "\n\r1 - Array of Integer"
                              + "\n\r2 - Array of Double");
            n = InputFromConsole.IsInteger(true);
            switch (n)
            {
            case 1:
                processingIntegerArray();
                break;

            case 2:
                processingDoubleArray();
                break;
            }
        }
예제 #6
0
        public static void Main()
        {
            Console.WriteLine("Task 2.3 for XT_EPAM" + "\n\r--------------------");
            string name, surname, patronymic, dateOfBirth;
            int    age;

            Console.WriteLine(" Enter Name: ");
            name = Console.ReadLine();
            Console.WriteLine(" Enter Surname: ");
            surname = Console.ReadLine();
            Console.WriteLine(" Enter Patronymic: ");
            patronymic = Console.ReadLine();
            Console.WriteLine(" Enter Date of Birth: ");
            dateOfBirth = Console.ReadLine();
            Console.WriteLine(" Enter Age: ");
            age = InputFromConsole.IsInteger();

            User first = new User(name, patronymic, surname, age, dateOfBirth);

            first.GetInfo();
        }
예제 #7
0
        public static void Main()
        {
            Console.WriteLine("Task 2.1 for XT_EPAM" + "\n\r--------------------");
            int    x;
            int    y;
            double r;

            Console.WriteLine("Enter X:");
            x = InputFromConsole.IsInteger();
            Console.WriteLine("Enter Y:");
            y = InputFromConsole.IsInteger();
            Console.WriteLine("Enter R:");
            r = InputFromConsole.IsDouble();

            Point p1 = new Point(x, y);

            Round Circle  = new Round(x, y);
            Round Circle2 = new Round(p1);

            Circle.GetInfo();
            Circle2.GetInfo();
        }
예제 #8
0
        public static void Main()
        {
            int n, m, sum = 0;

            Console.WriteLine("Task 1.10 for XT_EPAM" + "\n\r--------------------");
            Console.WriteLine("Enter array size: \n\rN x M ");
            n             = InputFromConsole.IsInteger();
            m             = InputFromConsole.IsInteger();
            int [,] array = Arrays.CreateArray(n, m, n * 10, false, true); //Создаем и заполняем массив
            //Высчитываем сумму элементов на четных позициях
            for (int i = 0; i < n; i++)
            {
                for (int j = 0; j < m; j++)
                {
                    if ((i + j) % 2 == 0)
                    {
                        sum += array[i, j];
                    }
                }
            }
            Console.WriteLine($"Summ of even elements is: \n\r{sum}");
        }