展开全部
Private Sub Command1_Click()
Dim a(1 To 10)
For i = 1 To 10
a(i) = Val(InputBox("输入第" & i & "个数"))
Next i
'原来的数组
For i = 1 To UBound(a)
Print a(i);
Next i
Print
'交换数值
k = UBound(a)
For i = 1 To k / 2
m = a(i): a(i) = a(k + 1 - i): a(k + 1 - i) = m
Next i
'交换后的数组
For i = 1 To UBound(a)
Print a(i);
Next i
Print
End Sub
Dim a(1 To 10)
For i = 1 To 10
a(i) = Val(InputBox("输入第" & i & "个数"))
Next i
'原来的数组
For i = 1 To UBound(a)
Print a(i);
Next i
'交换数值
k = UBound(a)
For i = 1 To k / 2
m = a(i): a(i) = a(k + 1 - i): a(k + 1 - i) = m
Next i
'交换后的数组
For i = 1 To UBound(a)
Print a(i);
Next i
End Sub
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询