Exemple #1
0
        public void coneTask(TextBox field, int M, bool detailed)
        {
            field.Text = "Сone with the largest volume:\r\n";

            Cone[] arr    = new Cone[M];
            float  max    = 0;
            int    result = 0;

            for (int i = 0; i < M; i++)
            {
                arr[i] = new Cone((float)rand.Next(15) + 1, (float)rand.Next(31) + 1);
                if (arr[i].getVolume() > max)
                {
                    max    = arr[i].getVolume();
                    result = i;
                }
            }

            field.Text += "CONE " + (result + 1) + "\r\n";
            if (detailed)
            {
                field.Text += arr[result].info(true);
            }
            field.Text += "\r\n";

            field.Text += "\r\nFull list:\r\n\r\n";
            for (int i = 0; i < M; i++)
            {
                field.Text += "CONE " + (i + 1) + "\r\n" + arr[i].info(true) + "\r\n";
            }
        }
Exemple #2
0
        public void coneTest(TextBox field)
        {
            Cone cone = new Cone((float)rand.Next(15) + 1, (float)rand.Next(31) + 1);

            field.Text = "Cone info:\r\n" + cone.info(true);
        }