2楼还真够耐心.
一般这种问题.我是一笑而过.
当然还是好人多嘛~~~,我还真的谢谢他的耐心呢,要都和你似的,一笑而过,我看我就的一哭半年了。。。。。
Option Explicit
Dim a#, b#, c#, x#, x1, x2
Private Sub Command1_Click()
a = Val(Text1.Text)
b = Val(Text2.Text)
c = Val(Text3.Text)
If a = 0 Then
x = -c / b
x1 = x
Text4.Text = x1
Text5.Text = ""
ElseIf a <> 0 And b * b - 4 * a * c = 0 Then
x = -b / (2 * a)
x1 = x
x2 = x
Text4.Text = x1
Text5.Text = x2
ElseIf a <> 0 And b * b - 4 * a * c > 0 Then
x1 = (-b + Sqr(b * b - 4 * a * c)) / (2 * a) '求根公式都能写错,我晕
x2 = (-b - Sqr(b * b - 4 * a * c)) / (2 * a)
Text4.Text = x1
Text5.Text = x2
ElseIf a <> 0 And b * b - 4 * a * c < 0 Then
x1 = (-b) / (2 * a) & "+" & Sqr(-(b * b - 4 * a * c)) / (2 * a) & "i"
x2 = (-b) / (2 * a) & "-" & Sqr(-(b * b - 4 * a * c)) / (2 * a) & "i"
Text4.Text = x1
Text5.Text = x2
End If
End Sub
Private Sub Command2_Click()
End
End Sub
我试了,可以的啊