Option Explicit
Dim a#, b#, c#, x#, x1#, x2#
Private Sub Command1_Click()
a = Text1.Text
b = Text2.Text
c = Text3.Text
If a = 0 Then
x = -c / b
x1 = x
Text4.Text = x1
ElseIf a <> 0 & b * b - 4 * a * c = 0 Then
x = -b / 2 * a
x1 = x2 = x
Text4.Text = x1
Text5.Text = x2
ElseIf a <> 0 & b * b - 4 * a * c > 0 Then
x = -b + (b * b - Sqr(4 * a * c)) / 2 * a & x = -b - (b * b - Sqr(4 * a * c)) / 2 * a
x1 = x & x2 = x
Text4.Text = x1
Text5.Text = x2
ElseIf a <> 0 & b * b - 4 * a * c < 0 Then
x = "有虚根"
x1 = x
Text4.Text = x1
End If
End Sub
Private Sub Command2_Click()
End
End Sub
Private Sub Form_Load()
End Sub