Exemplo n.º 1
0
        static void Main(string[] args)
        {
            // Declare variables
            double min, max;

            SuperList.MinMax valores;

            Tuple <double, double> t;

            // Instanciar Superlist
            SuperList list = new SuperList()
            {
                -24, 3, 4.5, -2.3, -100.3, 23
            };

            // Get min and max
            list.GetMinMax(out min, out max);

            valores = list.GetMinMax();

            t = list.GetMinMax2();

            // Print out first result with first method overload
            Console.WriteLine($"{min} and {max}");

            Console.WriteLine();

            // Print out second result with second method overload
            Console.WriteLine($"{valores.Min} and {valores.Max}");

            Console.WriteLine();

            // Print out third result with third method overload with tuples
            Console.WriteLine($"{t.Item1} and {t.Item2}");
        }
Exemplo n.º 2
0
        static void Main(string[] args)
        {
            SuperList sl = new SuperList()
            {
                -34, 5, 23, -25, -1005, 2525
            };

            double min;
            double max;

            sl.GetMinMax(out min, out max);

            Console.WriteLine(min);
            Console.WriteLine(max);

            SuperList.MinMax valores;

            valores = sl.GetMinMax();

            Console.WriteLine($"{valores.Min} e {valores.Max}");

            Tuple <double, double> t;

            t = sl.GetMinMax2();

            Console.WriteLine($"{t.Item1} & {t.Item2}");
        }
Exemplo n.º 3
0
        static void Main(string[] args)
        {
            double min1, max1;

            SuperList.MinMax2      MM2Struct;
            Tuple <double, double> MM3Tuple;

            SuperList lst = new SuperList()
            {
                12.3, 1.0, 0.4, 16, 92
            };

            lst.GetMinMax1(out min1, out max1);

            Console.WriteLine($"Min1: {min1}\nMax1: {max1}");

            // 2nd GetMinMax
            MM2Struct = lst.GetMinMax2();

            Console.WriteLine($"Min2: {MM2Struct.Min}\n" +
                              $"Max2: {MM2Struct.Max}");

            // 3rd GetMinMax
            MM3Tuple = lst.GetMinMax3();

            Console.WriteLine($"Min3: {MM3Tuple.Item1}\n" +
                              $"Max3: {MM3Tuple.Item2}");
        }
Exemplo n.º 4
0
        static void Main(string[] args)
        {
            SuperList sl = new SuperList()
            {
                4, -5, 10, -11, 40, 14, 51, 0
            };

            double min, max;

            SuperList.MinMax       minMax;
            Tuple <double, double> refTuple;

            (double min, double max)valTuple;

            sl.GetMinMax1(out min, out max);
            Console.WriteLine($"v1: min = {min}, max = {max}");

            minMax = sl.GetMinMax2();
            Console.WriteLine($"v2: min = {minMax.Min}, max = {minMax.Max}");

            refTuple = sl.GetMinMax3();
            Console.WriteLine($"v3: min = {refTuple.Item1}, max = {refTuple.Item2}");

            valTuple = sl.GetMinMax4();
            Console.WriteLine($"v4: min = {valTuple.min}, max = {valTuple.max}");
        }
Exemplo n.º 5
0
        static void Main(string[] args)
        {
            double min, max;

            SuperList spList = new SuperList {
                1.0, 3.5, 2.7, 60.4, 17.4, 0.8
            };

            spList.GetMinMax(out min, out max);

            Console.WriteLine($"min is {min}, max is {max}");
            Console.ReadKey();
        }
Exemplo n.º 6
0
        static void Main(string[] args)
        {
            SuperList myList = new SuperList()
            {
                10.5, -1.5, 2.3, 40.9, 0.0
            };
            double min, max;

            myList.GetMinMax1(out min, out max);
            Console.WriteLine($"Min = {min} | Max = {max}");

            SuperList.MinMax mm = myList.GetMinMax2();
            Console.WriteLine($"Min = {mm.Min} | Max = {mm.Max}");

            Tuple <double, double> tp = myList.GetMinMax3();

            Console.WriteLine($"Min = {tp.Item1} | Max = {tp.Item2}");

            (double min, double max)valTp = myList.GetMinMax4();
            Console.WriteLine($"Min = {valTp.min} | Max = {valTp.max}");
        }