已知方程“x^2+sin(x)-1=0”在区间[0,1]之间单调上升且有唯一解,可用对分思想不断缩小正解所在区间,找出其近似解(要求:误差小于0.001,结果截取3位小数)。单击“求解”按钮Command1,方程近似解显示在文本框Text1中。程序运行界面如下所示:

实现上述功能的VB程序如下,请在划线处填入合适代码。
Private Function fun(x As Single) As Single
fun =" x" ^ 2 + Sin(x) - 1
End Function
Private Sub Command1_Click()
Dim i As Integer
Dim x1 As Single, x2 As Single, y As Single, y1 As Single, y2 As Single
Dim mid As Single
x1 = 0
x2 = 1
y1 =" fun(x1)" '小于0
y2 =" fun(x2)" '大于0
For i =" 1" To
① '确定合适终值,使最终结果恰好小于0.001
mid =" (x1" + x2) / 2
y = fun(mid)
If y < 0 Then
x1 = mid
ElseIf y > 0 The
② [:Z*xx*k.Com]Else
Exit For
End If
Next i
'结果截取3位小数
'CStr(Format(0.63756, "0.000"))返回“0.638”
Text1.Text = CStr(Format(
③ , "0.000"))
End Sub