随机生成正整数数组a,并将数组中各元素以金字塔显示,要求对金字塔每层中的数据排序处理,奇数行升序排列,偶数行降序排列,效果见下图。请为划线处选择合适的代码。( )
Dim a(1 To 15) As Integer, num As Integer, s As String
'生成数组a,a(1)=73,a(2)=58, a(3)=62, a(4)=36…代码略
Private Sub Command1_Click()’对数组进行排序
num = 5: k = 1: f = 1
For i = 1 To num
k = k + i
For m = k - i To ①
For n = k - i To 2 * k - 2 - i - m
If ② Then t = a(n): a(n) = a(n + 1): a(n + 1) = t
Next n
Next m
f = f * (-1)
Next i
'将处理后的数组,以金字塔形显示,代码略
End Sub