Beispiel #1
0
        static void Main(string[] args)
        {
            int[,] nums1 = new int[, ] {
                { 0, -1, 2 }, { 3, -4, -5 }, { 0, 1, -2 }
            };
            int[,] nums2 = new[, ] {
                { 0, 1, 2 }, { 3, 4, 5 }, { 3, 4, 5 }
            };
            int[,] nums3 = { { 0, 1, 2 }, { 3, 4, 5 } };
            Matrix matrixOne   = new Matrix(nums1);
            Matrix matrixTwo   = new Matrix(5, 5);
            Matrix matrixThree = new Matrix(nums2);
            Matrix matrixFour  = new Matrix(nums1);
            int    countNeg    = (int)matrixOne;

            Console.WriteLine($"Количество отрицательных элементов -  { countNeg}");
            matrixOne.print();
            StatisticOperation.Negative(matrixOne);
            Console.WriteLine(StatisticOperation.FirstNum(matrixTwo, 2));
            matrixOne.print();
            matrixTwo.print();
            matrixThree.print();
            Matrix matrixSum = new Matrix(matrixOne + matrixThree);

            matrixSum.print();
            string Nword = "ппппприветик";

            Console.WriteLine(StringOperation.CharCount(Nword, 'п'));
            Console.WriteLine(matrixOne == matrixFour);
            Matrix.Owner owner = new Matrix.Owner(12, "dfs", "dsff");
            matrixOne--;
            matrixOne.print();
        }
Beispiel #2
0
        private void ReloadStatistics(StatisticOperation operation, Statistic stat)
        {
            switch (operation)
            {
            case StatisticOperation.Added:
                _statistics.Add(stat);
                break;

            case StatisticOperation.Deleted:
                _statistics.Remove(stat);
                break;
            }
        }
Beispiel #3
0
        static void Main(string[] args)
        {
            MyList.Owner owner = new MyList.Owner();
            owner.name = "Anastasia";
            Console.WriteLine(owner.name);

            Date date = new Date();

            Console.WriteLine(date.dataTime() + "\n");

            int    number = 5;
            MyList list   = new MyList(number);
            MyList list1  = new MyList(number);

            Console.WriteLine("The first list is ");
            for (int i = 0; i < number; i++)
            {
                Console.Write(list[i] + " ");
            }
            Console.WriteLine("\nIts sum is " + StatisticOperation.Sum(list) +
                              "\nThe diference between its elements is " + StatisticOperation.Difference(list) +
                              "\nIts quantity is " + StatisticOperation.Quantity(list) + "\n");

            Console.WriteLine("\nThe second list is ");
            for (int i = 0; i < number; i++)
            {
                Console.Write(list1[i] + " ");
            }
            Console.WriteLine("\nIts sum is " + StatisticOperation.Sum(list1) +
                              "\nThe diference between its elements is " + StatisticOperation.Difference(list1) +
                              "\nIts quantity is " + StatisticOperation.Quantity(list1) + "\n");


            Console.WriteLine("\n\nList1 == List2 ? The answer is " + (list == list1)
                              + "\n\nAfter the +operator ");
            list += 1;
            for (int i = 0; i < list.number; i++)
            {
                Console.Write(list[i] + " ");
            }

            Console.WriteLine("\n\nThe decriment of the list: ");
            list--;
            for (int i = 0; i < list.number; i++)
            {
                Console.Write(list[i] + " ");
            }

            Console.WriteLine("\n\nThe multiplication of two lists: ");
            MyList rlist = list * list1;

            for (int i = 0; i < rlist.number; i++)
            {
                Console.Write(rlist.myLists[i] + " ");
            }

            Console.WriteLine("\n\nChecking out the string operations: \nEnter the string");
            string str = Console.ReadLine();

            Console.WriteLine("There's " + StatisticOperation.Str(str) + " words with uppercase words");

            Console.WriteLine("\nIs there any same elements in the 2 list?\n"
                              + StatisticOperation.CheckTheSame(list1));



            Console.ReadKey();
        }
Beispiel #4
0
 public StatisticsUpdatedEventArgs(StatisticOperation operation, Statistic statistic)
 {
     Operation        = operation;
     ChangedStatistic = statistic;
 }
Beispiel #5
0
 protected virtual void OnStatisticsUpdated(StatisticOperation operation, Statistic stat)
 {
     ReloadStatistics(operation, stat);
     StatisticsUpdated?.Invoke(this, new StatisticsUpdatedEventArgs(operation, stat));
 }