用VB编写一个简单公式程序

来源:百度知道 编辑:UC知道 时间:2024/06/15 20:25:26
编写一个公式计算,V=0.7854L×[D+0.5L+0.005L2+0.000125L×(14-L)2×(D-10)]2÷1000。提供D,L的值能够求出V的值,急 其中公式中单独的2都是平方,不是乘
最好能在0.000125L×(14-L)2×(D-10)这部分结果保留3位有效数字

建一个Command1,单击按钮即可。
代码如下。
===============
Private Sub Command1_Click()
Dim D As Double, L As Double, v As Double
D = InputBox("D=?")
L = InputBox("L=?")
v = 0.7854 * L * (D + 0.5 * L + 0.005 * L ^ 2 + Round(0.000125 * L * (14 - L) ^ 2 * (D - 10), 3)) ^ 2 / 1000
Print v
End Sub

Private Sub Command1_Click()
Dim D As Double, L As Double
D = Text1.text
L = Text2.text
v = 0.7854 * L * (D + 0.5 * L + 0.005 * L ^ 2 + format(0.000125 * L * (14 - L) ^ 2 * (D - 10),"0.000")) ^ 2 / 1000
Print v
End Sub

Private Sub Command1_Click()
Dim D As Double, L As Double
D = Text1.text
L = Text2.text
v = 0.7854 * L * (D + 0.5 * L + 0.005 * L ^ 2 + Round(0.000125 * L * (14 - L) ^ 2 * (D - 10),3)) ^ 2 / 1000
Print v
End Sub

Private Sub Command1_Click()
Dim D As Double, L,v As Double
D = Text1.text
L = Text2.text <