实现上述功能的VB程序如下,请在划线处填入合适的语句。
Function f(x As Double) As Double
Dim y As Double
f = y
End Function
Private Sub Command1_Click()
Dim a As Double, b As Double, m As Double, x As Double
a = Val(Text1.Text)
b = Val(Text2.Text)
If f(a) * f(b) < 0 And a < b Then
Do While a <= b
If Abs(f(m)) < 0.00001 Then Exit Do
If Then
b = m
Else
a = m
End If
Loop
x = Format(m, “0.00000”) ′Format函数用于定义输出的小数位数
List1.AddItem “[” & Text1.Text & “,” & Text2.Text & “]” & “解为:” & x
Else
List1.AddItem “[“ & a & ”,“ & b & ”]” & “请重新输入区间”
End If
End Sub