首页
社区
课程
招聘
求助]关于VB调试的问题
发表于: 2009-6-28 11:25 3111

求助]关于VB调试的问题

2009-6-28 11:25
3111
程序设计时在窗体上用TextBox 控件建立D 、L 、H 和B 这4 个数据输入文本框,其名称属性分别
定义为Txtinp ut1 、Txtinp ut2 、Txtinp ut3 和Txtin2
put4 , 其Text 属性均为空格。用Label 控件在窗体
上建立4 个标签,其Caption 属性分别定义为D 、L 、
H 和B ,4 个参数的长度单位均为mm 。再用Com2
mand Button 控件在窗体上建立2 个命令按钮,其
名称属性分别定义为Cmd Calculate 和Cmd Can2
cel , 其Caption 属性分别定义为计算、打印和清除。

  程序代码如下:

Private Sub CmdCalculate_Click ()

Const PI=31 141592654

Dim D As Single , L As Single , H As Single ,
B As Single
Dim I As Integer , X As Single , VF As Sin2
gle , S As Single
Dim VT As Single, V AsDouble, S1 As Sin2
gle , S2 As Single
D = Val ( Txtinput11 Text )     ′将筒体内
直径赋值给D
L =Val (Txtinput21 Text)  ′将筒体长度赋值
给L
H = Val ( Txtinput31 Text)     ′将封头直
边高度赋值给H
B = Val (Txtinput41 Text)     ′将封头曲
面高度赋值给B
Printer1 Print″筒体内直径D(mm) = ″; D,″筒
体长度L (mm) = ″;L
Printer1 Print″封头直边高度H(mm) = ″; H,″
封头曲面高度B(mm) = ″;B

h =10

Do Until h>D
筒体长度L (mm) = 1500
VT=S 3 (L +2 3 H)    ′筒体标定容积封头直边高度H(mm) = 25
V= (VF+VT)/1000000000
″;h ,″标定体积
 ′容器标定容积封头曲面高度B(mm) = 150
Printer1 Print″标高h(mm) =

标高h(mm) = 10   标定体积V(m3) =1 00164


X=h-D/2

VF =2 3 ((PI 3 (B ∧2/ (D/ 2) ∧2) 3 ( (D/ 2) ∧2
3 X-X∧3/3)) -(( -2 3 PI/ 3) 3 (D/ 2)
3 B ∧2) )
′封头标定容积

S1= (-PI/2) 3 (D/ 2) ∧2
S2 = X 3 Sqr ((D/ 2) ∧2-X∧2) + (D/2) ∧2 3
Arcsin (X/ (D/2))
S=S2-S1
V(m3) =
h = h +10
Loop
End Sub

; Round (V ,5)
Private Sub CmdCancel_Click ()
Txtinp ut11 Text = ″
Txtinp ut21 Text = ″
Txtinp ut31 Text = ″
Txtinp ut41 Text = ″
End Sub

Private Function Arcsin(X As Single) As Single
Dim K!, I!, N!
Dim T As Single ,P As Single ,R As Single
K=1:I=2
T=1:N =1
R=0
Do
Do Until K>2 3 N-1
Do Until I>2 3 N
T= T 3 ( K/ I)
K= K+2
I=I+2
Loop
Loop
P= T 3 (X∧ (2 3 N+1)) / (2 3 N +1)
R=R+P
N=N+1
Loop Until Abs (P) <01 0000000001
Arcsin = R + X
End Function

可是调试就是通不过,求高人指点!

[注意]传递专业知识、拓宽行业人脉——看雪讲师团队等你加入!

收藏
免费 0
支持
分享
最新回复 (0)
游客
登录 | 注册 方可回帖
返回
//