Пример #1
0
 static void Main(string[] args)
 {
     // Uncomment what is needed to run and comment what is not.
     //Task1_1Rectangle.ConsoleInterface();
     //Task1_2Triangle.ConsoleInterface();
     //Task1_3AnotherTriangle.ConsoleInterface();
     //Task1_4X_masTree.ConsoleInterface();
     //Task1_5SumOfNumbers.ConsoleInterface();
     //Task1_6FontAdjustment.ConsoleInterface();
     Task7ArrayProcessing.ConsoleInterface();
     //Task1_8NoPositive.ConsoleInterface();
     //Task1_9NonNegativeSum.ConsoleInterface();
     //Task1_10TwoDArray.ConsoleInterface();
     //Task1_11AverageStringLength.ConsoleInterface();
     //Task1_12CharDoubler.ConsoleInterface();
 }
Пример #2
0
        // An interaction interface.
        internal static void ConsoleInterface()
        {
            // Create new instance of Random class.
            Random rand = new Random(DateTime.Now.Millisecond);

            // Create new array of integer numbers with length equals 10.
            int[] arrayOneDimensional = new int[10];
            // Assign all elements to random numbers.
            Task7ArrayProcessing.InitializeArray(arrayOneDimensional);
            // Display all elements.
            Task7ArrayProcessing.Show(arrayOneDimensional);
            // Display sum of all non-negative values.
            Console.WriteLine("The summ of non-negative elements equals to " +
                              NonNegativeSum(arrayOneDimensional));
            arrayOneDimensional = null;
            // Assign all elements to random numbers.
            Task7ArrayProcessing.InitializeArray(arrayOneDimensional);
            // Display all elements.
            Task7ArrayProcessing.Show(arrayOneDimensional);
            // Display sum of all non-negative values.
            Console.WriteLine("The summ of non-negative elements equals to " +
                              NonNegativeSum(arrayOneDimensional));
        }