【答案解析】[操作步骤]
步骤1:打开本题项目工程。
步骤2:打开代码编辑窗口,去掉程序中的注释符“"”,将问号改为正确的内容。
参考答案(加粗部分是需考生填入的内容)
Private Sub Command1_Click()
Dim a(10) As Integer
Dim i As Integer
Text1.Text=" "
Randomize
For i=1 To 10
a(i)
=Int(Rnd*100+1)
Text1.Text=Text1.Text&a(i)&" "
Next i
Call Exchange(a)
Text2.Text=" "
For i=1 To 10
Text2.Text=Text2.Text&a(i)&" "
Next i
End Sub
Private Sub Exchange(ByRef Data() As Integer)
Dim i As Integer,m As Integer,index As Integer
Dim t As Integer
Dim f As Integer
f=LBound(Data)
index=LBound(Data)
m=Data(index)
For i=f+1 To UBound(Data)
If Data(i)>m Then
m=
Data(i)
index
=i
End If
Next i
t=Data(f)
Data(f)=Data(index)
Data(index)=t
End Sub
步骤3:调试并运行程序,关闭程序后按题目要求存盘。
答案考生文件夹
[解析] 本题主要考核对数组中元素的基本操作,利用循环语句找出数组中的最大值,并将保存最大值和其所对应的下标,然后将最大值与数组中的第一个元素进行互换操作。