为什么运行这个程序之后,vb会卡死?
PrivateSubCommand1_Click()Dimi,mAsInteger,h,h1,z1,z2,A,v,A1,v1,Q1,Q2AsSinglem=Val(Tex...
Private Sub Command1_Click()
Dim i, m As Integer, h, h1, z1, z2, A, v, A1, v1, Q1, Q2 As Single
m = Val(Text1.Text)
For i = 1 To m
Q1 = 16 * (m - i)
Q2 = 16 * (m - i + 1)
Do
h1 = 1
h = 3.87
A1 = (30 + h1) * h1 / 2
A = (30 + h) * h / 2
v1 = 240 / A1
v = 240 / A
z1 = ((v - v1) + (Q2 - Q1) * (v1 + v) / (Q1 + Q2)) * (v + v1) / 19.6
h1 = h1 + 0.01
Loop Until Abs(z1 - z2) <= 1e-2
Print h1
h = h1
h1 = 1
Next i
End Sub 展开
Dim i, m As Integer, h, h1, z1, z2, A, v, A1, v1, Q1, Q2 As Single
m = Val(Text1.Text)
For i = 1 To m
Q1 = 16 * (m - i)
Q2 = 16 * (m - i + 1)
Do
h1 = 1
h = 3.87
A1 = (30 + h1) * h1 / 2
A = (30 + h) * h / 2
v1 = 240 / A1
v = 240 / A
z1 = ((v - v1) + (Q2 - Q1) * (v1 + v) / (Q1 + Q2)) * (v + v1) / 19.6
h1 = h1 + 0.01
Loop Until Abs(z1 - z2) <= 1e-2
Print h1
h = h1
h1 = 1
Next i
End Sub 展开
1个回答
推荐于2016-02-17
展开全部
Private Sub Command1_Click()
Dim i, m As Integer, h, h1, z1, z2, A, v, A1, v1, Q1, Q2 As Single
m = Val(Text1.Text)
For i = 1 To m
Q1 = 16 * (m - i)
Q2 = 16 * (m - i + 1)
Do
DoEvents'增加这句,另外,你代码里z2怎么没有赋值
h1 = 1
h = 3.87
A1 = (30 + h1) * h1 / 2
A = (30 + h) * h / 2
v1 = 240 / A1
v = 240 / A
z1 = ((v - v1) + (Q2 - Q1) * (v1 + v) / (Q1 + Q2)) * (v + v1) / 19.6
h1 = h1 + 0.01
Loop Until Abs(z1 - z2) <= 0.01
Print h1
h = h1
h1 = 1
Next i
End Sub
Dim i, m As Integer, h, h1, z1, z2, A, v, A1, v1, Q1, Q2 As Single
m = Val(Text1.Text)
For i = 1 To m
Q1 = 16 * (m - i)
Q2 = 16 * (m - i + 1)
Do
DoEvents'增加这句,另外,你代码里z2怎么没有赋值
h1 = 1
h = 3.87
A1 = (30 + h1) * h1 / 2
A = (30 + h) * h / 2
v1 = 240 / A1
v = 240 / A
z1 = ((v - v1) + (Q2 - Q1) * (v1 + v) / (Q1 + Q2)) * (v + v1) / 19.6
h1 = h1 + 0.01
Loop Until Abs(z1 - z2) <= 0.01
Print h1
h = h1
h1 = 1
Next i
End Sub
本回答被提问者和网友采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询