Exemple #1
0
        static void Main(string[] args)
        {
            bool           exit = true;
            ConsoleKeyInfo key;

            while (exit)
            {
                Console.Clear();
                Console.WriteLine("Выберите задание");
                key = Console.ReadKey();
                Console.WriteLine();
                switch (key.KeyChar)
                {
                case '1':
                {
                    Console.WriteLine("Введите нужное количество точек:");
                    point[] point_arr = new point[Convert.ToInt32(Console.ReadLine())];
                    for (int i = 0; i < point_arr.Length; i++)
                    {
                        Console.WriteLine("Точка {0}", i + 1);
                        Console.Write("x="); point_arr[i].x_coord = Convert.ToDouble(Console.ReadLine());
                        Console.Write("y="); point_arr[i].y_coord = Convert.ToDouble(Console.ReadLine());
                    }
                    TaskMethods.MaxPointsLenght(point_arr);
                    Console.ReadKey();
                    break;
                }

                case '2':
                {
                    Console.WriteLine("Сколько слов вы хотите ввести?");
                    string[] arr_words = new string[Convert.ToInt32(Console.ReadLine())];
                    for (int i = 0; i < arr_words.Length; i++)
                    {
                        Console.Write("Введите слово {0}:", i + 1);
                        arr_words[i] = Console.ReadLine();
                    }
                    int Count;
                    Console.WriteLine("Слово с наибольшим количеством гласных {0}, их количество {1}", TaskMethods.MaxVowelCount(arr_words, out Count), Count);
                    Console.ReadKey();
                    break;
                }

                case '3':
                {
                    Console.WriteLine("Cколько чисел вы хотите ввести?");
                    Int64[] arr_numbers = new Int64[Convert.ToInt32(Console.ReadLine())];
                    for (int i = 0; i < arr_numbers.Length; i++)
                    {
                        Console.Write("Введите число {0}:", i + 1);
                        arr_numbers[i] = Convert.ToInt64(Console.ReadLine());
                    }
                    for (int i = 0; i < arr_numbers.Length; i++)
                    {
                        Console.WriteLine("Число {0} на позиции {1} имеет сумму чисел {2}", arr_numbers[i], i + 1, Task2Var.SumNumbers(arr_numbers[i]));
                    }
                    Console.ReadKey();
                    break;
                }

                case '4':
                {
                    Console.WriteLine("Введите m, n, k, a");
                    Console.WriteLine("Результат функции  {0}", TaskMethods.SolveFunction(Convert.ToInt32(Console.ReadLine()), Convert.ToInt32(Console.ReadLine()), Convert.ToDouble(Console.ReadLine()), Convert.ToInt32(Console.ReadLine())));
                    Console.ReadKey();
                    break;
                }

                case '5':
                {
                    double[] points  = new double[4];
                    string   letters = "abcd";
                    for (int i = 0; i < points.Length; i++)
                    {
                        Console.WriteLine("Введите длину отрезка {0}", letters[i]);
                        points[i] = Convert.ToDouble(Console.ReadLine());
                    }
                    TaskMethods.TriangleSquare(points);
                    Console.ReadKey();
                    break;
                }

                case '6':
                {
                    Console.WriteLine("Введите число, факториал которого вы хотите найти:");
                    Console.WriteLine("Результат - {0}", TaskMethods.fact(Convert.ToInt32(Console.ReadLine())));
                    Console.ReadKey();
                    break;
                }

                default:

                    break;
                }
            }
        }