private void button4_Click(object sender, EventArgs e) { MessageBox.Show(circles.ToString()); richTextBox1.Text = Convert.ToString("Tast 1 (Quantity S < S cp)" + Environment.NewLine); double Scp = 0; int k = 0; double S = circles.GetCircleAt(0).Radius *circles.GetCircleAt(0).Radius * 3.14; for (int i = 0; i < circles.getCirclesNumber(); i++) { S = circles.GetCircleAt(i).Radius *circles.GetCircleAt(i).Radius * 3.14; Scp = Scp + S; } Scp = Scp / circles.getCirclesNumber(); for (int i = 0; i < circles.getCirclesNumber(); i++) { if ((circles.GetCircleAt(i).Radius *circles.GetCircleAt(i).Radius * 3.14) < Scp) { k = k + 1; richTextBox1.Text = richTextBox1.Text + Convert.ToString("№ " + (i + 1) + " " + circles.GetCircleAt(i)).ToString() + Environment.NewLine; } } richTextBox1.Text = richTextBox1.Text + Convert.ToString("Quantity = " + k); }
private void button5_Click(object sender, EventArgs e) { MessageBox.Show(circles.ToString()); richTextBox2.Text = Convert.ToString("Tast 2 (Quantity Vmax)" + Environment.NewLine); double Vmax = 0, V; for (int i = 0; i < circles.getCirclesNumber(); i++) { V = 0.3 * circles.GetCircleAt(i).Radius *circles.GetCircleAt(i).Radius /* circles.GetCircleAt(i).Height*/; if (V > Vmax) { Vmax = V; } } richTextBox2.Text += Convert.ToString("Vmax = " + Vmax + Environment.NewLine); }