Example #1
0
 /// <summary>
 /// The main entry point for the application.
 /// </summary>
 static void Main(string[] args)
 {
     using (Lab2 game = new Lab2())
     {
         game.Run();
     }
 }
Example #2
0
        static void Main(string[] args)
        {
            int num1 = 4;
            int num2 = 5;
            int num3 = 2;
            int num4 = 6;

            int sum = Lab2.GetSum(num1, num2, num3, num4);

            Debug.Assert(sum == 17);

            double average = Lab2.GetAverage(num1, num2, num3, num4);

            Debug.Assert(average == 4.25);

            int product = Lab2.Multiply(num1, num2);

            Debug.Assert(product == 20);

            int difference = Lab2.Subtract(num1, num2);

            Debug.Assert(difference == -1);

            string s1             = "First string";
            string s2             = " Second string";
            string combinedString = Lab2.CombineStrings(s1, s2);

            Debug.Assert(combinedString == "First string Second string");
        }
Example #3
0
        static void Main(string[] args)
        {
            Shape[] shapeArray = new Shape[100]; //Array for Shapes.
            string  userInput;                   //String User Input

            do
            {
                userInput = Lab2.Options();
                Lab2.CreateShape(shapeArray, userInput);
            }while(userInput != "0");
            Lab2.Display(shapeArray);
            System.Threading.Thread.Sleep(10000);
        }
Example #4
0
        public static void Main(string[] args)
        {
            var lab2 = new Lab2();

            lab2.Task1();
            lab2.Task2();
            lab2.Task3();
            lab2.Task4();

            Tuple <int, int, int, char> Func5(int[] mas, string str)
            {
                if (mas?.Length == 0)
                {
                    throw new ArgumentException("mas is null or empty");
                }
                if (str?.Length == 0)
                {
                    throw new ArgumentException("str is null or empty");
                }

                var tuple = (min : mas[0], max : mas[0], sum : mas[0], firstLetter : str[0]);

                for (int i = 1; i < mas.Length; i++)
                {
                    var val = mas[i];

                    if (val < tuple.min)
                    {
                        tuple.min = val;
                    }

                    if (val > tuple.max)
                    {
                        tuple.max = val;
                    }

                    tuple.sum += val;
                }

                return(tuple.ToTuple());
            }

            var(min, max, sum, firstLetter) = Func5(new[] { 1, -1, 3, 10, 0 }, "Sasha");

            Assert(min == -1);
            Assert(max == 10);
            Assert(sum == 13);
            Assert(firstLetter == 'S');
        }