实现上述功能的部分VB程序如下,请在划线处填入合适的代码。
Const n=20
Dim a(1 To 2*n) As Integer
Private Sub Form_Load()
'在数据库中读取20个监测点名称和其高度值在List1中显示。读取监测点高度值和每个监测点距赛道起点的距离值,存入数组a,其中a(1)、a(3)、a(5)…a(2*i-1)存储监测点高度值,a(2)、a(4)、a(6)…a(2*i)存储每个监测点距赛道起点的距离值,代码略
End Sub
Private Sub Command1_Click()
Dim i As Single, cnt As Integer, p As Integer
Dim max As Integer, s As Integer
s=Val(text1.Text)
smax=0
For i=1 To n
cnt=1
Do While
cnt=cnt+1
Loop
If cnt-1 >=3 And cnt-1 > max Then
max=cnt-1
End If
Next i
i=smax
If i=0 Then
Label5.Caption=″0″
Else
p=0
Do While i >=s
p=p+1
i=i / (p+1)
Loop
Label5.Caption=Str(p-1)
End If
End Sub
Function judge(x As Integer, y As Integer) As Boolean
judge=False
jmin=x: jmax=x
For m=
If a(2*m-1) < a(2*jmin-1) Then jmin=m
If a(2*m-1) > a(2*jmax-1) Then jmax=m
Next m
If a(2*jmax-1)-a(2*jmin-1) <=20 Then judge=True
End Function