Example #1
0
        public static void CalculateMenu(MyArray array)
        {
            Console.Clear();
            int choice = 0;

            Console.Write("1 - Sum of negative elements\n2 - Sum of all elements\nYour choice: ");
            choice = int.Parse(Console.ReadLine());
            switch (choice)
            {
            case 1:
                Console.Clear();
                array.RegisterToChange(SumNegativeElements);
                array.Change();
                break;

            case 2:
                Console.Clear();
                array.RegisterToChange(SumAllElements);
                array.Change();
                break;

            default:
                break;
            }
        }
Example #2
0
        public static void ChangeMenu(MyArray array)
        {
            Console.Clear();
            int choice = 0;

            Console.Write("1 - Change all elements to 0\n2 - Sort array\nYour choice: ");
            choice = int.Parse(Console.ReadLine());
            switch (choice)
            {
            case 1:
                Console.Clear();
                array.RegisterToChange(NegativeToNull);
                array.Change();
                break;

            case 2:
                Console.Clear();
                array.RegisterToChange(SortArray);
                array.Change();
                break;

            default:
                break;
            }
        }