修改时间:2021-08-02 浏览次数:52 类型:期末考试
Private Sub Command1_Click()
Text1.Text = ""
Text2.Text = ""
Text3.Text = ""
Text4.Text = ""
End Sub
Private Sub Command2_Click()
Dim a As Single, b As Single, c As Single
Dim x1 As Single, x2 As Single, det As Single
a = Val(Text1.Text)
b = Val(Text2.Text)
c = Val(Text3.Text)
det = ‘(根的判别式b2-4ac)
Select Case det
Case Is > 0
x1 = (-b + Sqr(det)) / (2 * a)
x2 = (-b - Sqr(det)) / (2 * a)
Text4.Text = "方程有两个实数根" & " x=" & Str(x1) & " x=" & Str(x2)
Case Is = 0
Text4.Text = "方程有两个相等的实数根 x=" & Str(x1)
Case
Text4.Text = "此方程无实数根"
End Sub
试题篮