A. vb實驗指導書實驗5-5怎麼做
Private Sub Command1_Click()
Dim delt!, a#, b#, c#
a = InputBox("輸入系數a", , 1)
b = InputBox("輸入系數b", , 3)
c = InputBox("輸入系數c", , 2)
Label2.Caption = "a=" & a & ",b=" & ",c=" & c
delt = b * b - 4 * a * c
If delt >= 0 Then
delt = Sqr(delt)
Label1.Caption = "X1=" & (-b + delt) / 2 / a & vbCrLf & "X2=" & (-b - delt) / 2 / a
Else
Label1.Caption = "無實根"
End If
End Sub