Private Sub CmdSolve_Click()
Dim a As Single, b As Single, c As Single, p As Single
Dim x1 As Single, X2 As Single, e As Single, f As Single
a = Val(txtA.Text)
b = Val(txtB.Text)
c = Val(txtC.Text)
p = b ^ 2 - 4 * a * c
If a = 0 Then
txtRoot1.Text = "无解"
txtRoot2.Text = "无解"
Else
If p >= 0 Then
x1 = (-b + Sqr(p)) / (2 * a)
X2 = (-b - Sqr(p)) / (2 * a)
txtRoot1.Text = x1
txtRoot2.Text = X2
Else
e = -b / (2 * a)
f = (Sqr(-p)) / (2 * a)
txtRoot1.Text = Str(e) & "+" & Str(f) & "i"
txtRoot2.Text = Str(e) & "+" & Str(f) & "i"
End If
End If
End Sub
时段 | 个数 |
---|---|
{{f.startingTime}}点 - {{f.endTime}}点 | {{f.fileCount}} |