这就是do loop while a啊
Private Sub Form_Click()
Dim tal As Double, lin As Double, i%
i = 0: lin = 1
Do
'e≈1+(1/1!)+(1/2!)+(1/3!)+…+(1/n!)
tal = 1
i = i + 1
For j = 2 To i
tal = tal * j
Next j
lin = lin + 1 / tal
Loop while 1 / tal >= 0.0001
Print lin
End Sub
Private Sub Form_Click()
Dim e#, i!, t#
e = 1
i = 1
t = 1
Do While (1 / t) >= (10 ^ -4)
t = t * i
e = e + 1 / t
i = i + 1
Loop
Print e
End Sub
假定窗体form1上有一个label1控件用来显示结果,那么,只需要在form1_load()中加入以下语句即可:
label1.caption
=
round(
exp(
1
)
,
5
)