VB程序设计试题
在我国北方某重工业城市的某钢铁企业,年排污为80万吨,根据本城市的管道要求,城市道路管径采用800mm管径;企业(接入城市管网)管道长为1000m,设计坡度要求不小于0....
在我国北方某重工业城市的某钢铁企业,年排污为80万吨,根据本城市的管道要求,城市道路管径采用800mm管径;企业(接入城市管网)管道长为1000m,设计坡度要求不小于0.0030,管壁粗糙系数n取0.014。运用所学程序语言进行给排水程序设计,解出管道过水断面的夹角最经济值。管道夹角θ取值为 0.001<θ<2,θ取值精度为0.001
主程序编辑如下:
Private Sub Command1_Click()
Dim a As Single, b As Single, f As Single
Dim aa As Single, bb As Single, aaa As Single, bbb As Single
Dim x As Single, f1 As Single, f2 As Single
Dim d As Single, i As Single, qs As Single, n As Single
Dim k As Single, z As Single, y As Single
n = 0.014
d = 4
i = 0.003
qs = 25
a = Val(Text2.Text)
b = Val(Text3.Text)
a = 0.001 b =6.28
aa = d / 4 * (1 - Sin(a) / a)
aaa = (aa ^ 2) ^ (1 / 3)
bb = d / 4 * (1 - Sin(b) / b)
bbb = (bb ^ 2) ^ (1 / 3)
f1 = (d ^ 2 / (8 * n)) * (a - Sin(a)) * aaa * Sqr(i) - qs
f2 = (d ^ 2 / (8 * n)) * (b - Sin(b)) * bbb * Sqr(i) – qs
Do
x = (a + b) / 2
y = d / 4 * (1 - Sin(x) / x)
z = (y ^ 2) ^ (1 / 3)
f = (d ^ 2 / (8 * n)) * (x - Sin(x)) * z * Sqr(i) – qs
If (f * f1) >= 0 Then
a = x: f1 = f
Else
b = x: f2 = f
End If
Loop While Abs(a - b) > 0.001 And f > 0.001
If f > 0.001 Then x = (a + b) / 2
Text4.Text = x
End Sub
帮看看有哪不对 还有该怎么修改的 展开
主程序编辑如下:
Private Sub Command1_Click()
Dim a As Single, b As Single, f As Single
Dim aa As Single, bb As Single, aaa As Single, bbb As Single
Dim x As Single, f1 As Single, f2 As Single
Dim d As Single, i As Single, qs As Single, n As Single
Dim k As Single, z As Single, y As Single
n = 0.014
d = 4
i = 0.003
qs = 25
a = Val(Text2.Text)
b = Val(Text3.Text)
a = 0.001 b =6.28
aa = d / 4 * (1 - Sin(a) / a)
aaa = (aa ^ 2) ^ (1 / 3)
bb = d / 4 * (1 - Sin(b) / b)
bbb = (bb ^ 2) ^ (1 / 3)
f1 = (d ^ 2 / (8 * n)) * (a - Sin(a)) * aaa * Sqr(i) - qs
f2 = (d ^ 2 / (8 * n)) * (b - Sin(b)) * bbb * Sqr(i) – qs
Do
x = (a + b) / 2
y = d / 4 * (1 - Sin(x) / x)
z = (y ^ 2) ^ (1 / 3)
f = (d ^ 2 / (8 * n)) * (x - Sin(x)) * z * Sqr(i) – qs
If (f * f1) >= 0 Then
a = x: f1 = f
Else
b = x: f2 = f
End If
Loop While Abs(a - b) > 0.001 And f > 0.001
If f > 0.001 Then x = (a + b) / 2
Text4.Text = x
End Sub
帮看看有哪不对 还有该怎么修改的 展开
2个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询