pragma endregion double sD x1 x2 private System Void button2_Click Sys

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
#pragma endregion
double a, b, c, D, sD, x1, x2, f, x, y;
private: System::Void button2_Click(System::Object^ sender, System::EventArgs^ e) {// закрити
Close();
}
private: System::Void button1_Click(System::Object^ sender, System::EventArgs^ e) {// видалити
textBox1 -> Clear();
textBox1 -> Focus();
textBox2 -> Clear();
textBox3 -> Clear();
label8 -> Text = "0";
label9 -> Text = "0";
label10 -> Text = "0";
label13 -> Text = "0";
label14 -> Text = "0";
label15 -> Text = "0";
label4 -> Text = "A * x^2 + B * x + C = 0";
}
private: System::Void button5_Click(System::Object^ sender, System::EventArgs^ e) {// розрахувати
if(textBox1 -> Text == "" || textBox2 -> Text == "" || textBox3 -> Text == "") {
MessageBox::Show("Введите значения: \nA, B, C", "Error", MessageBoxButtons::OK, MessageBoxIcon::Error);
textBox1 -> Clear();
textBox1 -> Focus();
textBox2 -> Clear();
textBox3 -> Clear();
label8 -> Text = "0";
label9 -> Text = "0";
label10 -> Text = "0";
label13 -> Text = "0";
label14 -> Text = "0";
label15 -> Text = "0";
label4 -> Text = "A * x^2 + B * x + C = 0";
} else {
label8 -> Visible = true;
label9 -> Visible = true;
label10 -> Visible = true;
a = System::Convert::ToDouble(textBox1 -> Text);
b = System::Convert::ToDouble(textBox2 -> Text);
c = System::Convert::ToDouble(textBox3 -> Text);
D = b*b-4*a*c;
sD = sqrt(D);
if(D >= 0) {
x1 = (-b+sD)/(2*a);
x2 = (-b-sD)/(2*a);
label11 -> Text = x1.ToString("n");
label12 -> Text = x2.ToString("n");
if(D == 0) { label8 -> Text = "1"; }
else { label8 -> Text = "2"; }
label9 -> Text = sD.ToString("n");
label10 -> Text = D.ToString("n");
x = x1;
y = x2;
f = (cos(abs(2*x))/1.12)-cos(3*y-2)+6.15;
label13 -> Text = f.ToString("n");
label15 -> Text = y.ToString("n");
label14 -> Text = x.ToString("n");
} else {
MessageBox::Show("****************\n D < 0\n****************", "Error", MessageBoxButtons::OK, MessageBoxIcon::Error);
textBox1 -> Clear();
textBox1 -> Focus();
textBox2 -> Clear();
textBox3 -> Clear();
label8 -> Text = "0";
label9 -> Text = "0";
label10 -> Text = "0";
label13 -> Text = "0";
label14 -> Text = "0";
label15 -> Text = "0";
}
}
}
private: System::Void button4_Click(System::Object^ sender, System::EventArgs^ e) {// корені
Form2 ^f2 = gcnew Form2();
f2 -> label3 -> Text = this -> label11 -> Text;
if(D == 0) { f2 -> label4 -> Text = "---"; }
else { f2 -> label4 -> Text = this -> label12 -> Text; }
f2 -> ShowDialog();
}
private: System::Void button3_Click(System::Object^ sender, System::EventArgs^ e) {// функція
if(textBox1 -> Text == "" || textBox2 -> Text == "" || textBox3 -> Text == "") {
MessageBox::Show("Введите значения: \nA, B, C", "Error", MessageBoxButtons::OK, MessageBoxIcon::Error);
textBox1 -> Clear();
textBox1 -> Focus();
textBox2 -> Clear();
textBox3 -> Clear();
label8 -> Text = "0";
label9 -> Text = "0";
label10 -> Text = "0";
label13 -> Text = "0";
label14 -> Text = "0";
label15 -> Text = "0";
} else {
Form3 ^f3 = gcnew Form3();
f3 -> label5 -> Text = this -> label13 -> Text;
f3 -> label6 -> Text = this -> label15 -> Text;
f3 -> label7 -> Text = this -> label14 -> Text;
f3 -> ShowDialog();
}
}