For循环解决置换问题
怎样用 For 循环 怎样解决 交换问题啊?比如 1 2 3 4
把4和1交换 3和2 交换
Option Explicit
Private Sub Command1_Click()
Dim a(1 To 4) As Integer
Dim t As Integer
Dim i As Integer
a(1) = 1: a(2) = 2
a(3) = 3: a(4) = 4
For i = 1 To 4
Print a(i);
Next
Print
For i = 1 To 2
t = a(5 - i)
a(5 - i) = a(i)
a(i) = t
Next
For i = 1 To 4
Print a(i);
Next
End Sub