编写一个公式计算,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位有效数字
用VB编写一个简单公式程序
答案:6 悬赏:0 手机版
解决时间 2021-04-12 01:32
- 提问者网友:一抹荒凉废墟
- 2021-04-11 02:08
最佳答案
- 五星知识达人网友:不甚了了
- 2021-04-11 03:12
建一个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, 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
全部回答
- 1楼网友:玩世
- 2021-04-11 09:29
上面的程序有问题
'给窗口加3个TEXT控件 text.text 都设为0,再加个COMMAND 控件
'付上以下程序 OK了
Private Sub Command1_Click()
Dim D As Single, L As Single
D = Val(Text1.Text)
L = val(Text2.Text)
v = 0.7854 * L * (D + 0.5 * L + 0.005 * L ^ 2 + 0.000125 * L * (14 - L) ^ 2 * (D - 10)) ^ 2 / 1000
Text3.Text = v
End Sub
- 2楼网友:十年萤火照君眠
- 2021-04-11 08:25
Private Sub Command1_Click()
Dim D As Double, L,v As Double
D = Text1.text
L = Text2.text
v = 0.7854 * L * (D + 0.5 * L + 0.005 * L ^ 2 + 0.000125 * L * (14 - L) ^ 2 * (D - 10)) ^ 2 / 1000
text3.text=v
End Sub
- 3楼网友:西风乍起
- 2021-04-11 06:48
'未作错误处理,假设你的数据都是合法的
private sub form_load()
dim f, x, p, n
n = inputbox("n:", , 10)
x = inputbox("x:", , 5)
p = x / n
f = fc(n) / (fc(x) * fc((n - x))) * p ^ x * (1 - p) ^ (n - x)
msgbox f
unload me
end sub
function fc(n)
dim i as long
fc = 1
for i = 1 to n
fc = fc * i
next
end function
- 4楼网友:渡鹤影
- 2021-04-11 05:09
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
- 5楼网友:北方的南先生
- 2021-04-11 04:26
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
我要举报
如以上问答信息为低俗、色情、不良、暴力、侵权、涉及违法等信息,可以点下面链接进行举报!
大家都在看
推荐资讯