VB计算E的近似值循环镶嵌问题.Dim e,n,ve = 1:v = 1:n = 1While 1 / v > 0.00001While 1 / v > 0.00001v = v * nn = n + 1Wende = e + 1 / vWendLabel1.Caption = "e的近似值为:" & e请帮我看看这代码那里有错,自己找了半天也找
来源:学生作业帮助网 编辑:六六作业网 时间:2025/01/19 21:19:11
VB计算E的近似值循环镶嵌问题.Dim e,n,ve = 1:v = 1:n = 1While 1 / v > 0.00001While 1 / v > 0.00001v = v * nn = n + 1Wende = e + 1 / vWendLabel1.Caption = "e的近似值为:" & e请帮我看看这代码那里有错,自己找了半天也找
VB计算E的近似值循环镶嵌问题.
Dim e,n,v
e = 1:v = 1:n = 1
While 1 / v > 0.00001
While 1 / v > 0.00001
v = v * n
n = n + 1
Wend
e = e + 1 / v
Wend
Label1.Caption = "e的近似值为:" & e
请帮我看看这代码那里有错,自己找了半天也找不出来,反正最后计算的结果不正确,
补充一个能计算出正确结果的单循环结构:
dim e,n,v
e=1:n=1:v=1
Do while 1/v>0.00001
v= v*n
n= n+1
e= e +1/v
loop
label1.caption=" e的近似值为:"&e
end sub
VB计算E的近似值循环镶嵌问题.Dim e,n,ve = 1:v = 1:n = 1While 1 / v > 0.00001While 1 / v > 0.00001v = v * nn = n + 1Wende = e + 1 / vWendLabel1.Caption = "e的近似值为:" & e请帮我看看这代码那里有错,自己找了半天也找
Private Sub Command1_Click()
'如果是题目要求用循环镶嵌个人觉得应该这样写
Dim e, n, v, n1
e = 1: v = 1: n = 1
While 1 / v > 0.00001
v = 1: n1 = 1
While n1 <= n
v = v * n1
n1 = n1 + 1
Wend
n = n + 1
e = e + 1 / v
Wend
Label1.Caption = "e的近似值为:" & e
End Sub