随机生成15个100以内[1,100]的正整数并显示在一个文本框中,再点击交换按钮将所有对称位置的两个数据对调后显示在另一个文本框中(第1个数与第15个数对调,第2个数与第14个数对调……)。小叶设计的运行界面和程序代码如下:
Dim a(1 To 15) As Integer
Private Sub Form_Load()
Dim i As Integer, t As Integer
Dim s1 As String, s2 As String
Randomize
s1 = ""
For i = 1 To 15
a(i) = ①
s1 = s1 + Str(a(i))
Next i
Text1.Text = s1
End Sub
Private Sub Com1_Click()
s2 = ""
For i = 1 To 15
s2 = ②
Next i
Text2.Text = s2
End Sub