VB程序设计编译
发布网友
发布时间:2022-05-23 13:55
我来回答
共1个回答
热心网友
时间:2023-10-23 20:23
Dim
mark(10)
As
Integer
Private
Sub
Command1_Click()
Randomize
For
i
=
1
To
10
mark(i)
=
Int(Rnd
*
101
-
400)
Text1.Text
=
Text1.Text
&
"
"
&
Str(mark(i))
Next
i
End
Sub
Public
Function
ProcMin(ByRef
markz()
As
Integer)
As
Integer
Dim
Min
As
Integer
Min
=
markz(1)
For
i
=
1
To
10
If
markz(i)
<
Min
Then
Min
=
markz(i)
End
If
Next
i
ProcMin
=
Min
End
Function
Private
Sub
Command2_Click()
Text2.Text
=
Str(ProcMin(mark))
End
Sub
首先你使用mark数组需要使用全局变量,其次你定义传递参数的子程序应为函数程序,用返回值来获取结果。