Dim i As Long, k As Long, j As Long Dim m As Long, n As Long Dim Number As Long Dim AllNumber As LongNumber = 10 Dim Layer As Long ReDim a(Number, Number) As Long Dim Count As Long’===========输出顺蛇形阵 init = 100 Count = initFor i = Number To 1 Step -2 Layer = (Number - i) / 2 + 1 For j = 1 To (i - 1) * 2 + 1 m = Layer n = Layer If j <= i Then m = m n = (j + n - 1) Else m = j Mod i + m n = Number - (Number - i) / 2 End If a(n, m) = (i - 1) * 4 + init * 2 - Count a(m, n) = Count Count = Count + 1 Next init = (i - 1) * 4 + init Count = init Next'=====================转置Dim t As Long For i = 1 To Number For j = i To Numbert = a(i, j) a(i, j) = a(j, i) a(j, i) = t Next Next'================输出For i = 1 To Number For j = 1 To NumberPrint (a(i, j));Next Print Next'''''''''''''QB,VB实用
Dim m As Long, n As Long
Dim Number As Long
Dim AllNumber As LongNumber = 10
Dim Layer As Long
ReDim a(Number, Number) As Long
Dim Count As Long’===========输出顺蛇形阵
init = 100
Count = initFor i = Number To 1 Step -2
Layer = (Number - i) / 2 + 1
For j = 1 To (i - 1) * 2 + 1
m = Layer
n = Layer
If j <= i Then
m = m
n = (j + n - 1)
Else
m = j Mod i + m
n = Number - (Number - i) / 2
End If
a(n, m) = (i - 1) * 4 + init * 2 - Count
a(m, n) = Count
Count = Count + 1
Next
init = (i - 1) * 4 + init
Count = init
Next'=====================转置Dim t As Long
For i = 1 To Number
For j = i To Numbert = a(i, j)
a(i, j) = a(j, i)
a(j, i) = t
Next
Next'================输出For i = 1 To Number
For j = 1 To NumberPrint (a(i, j));Next
Print
Next'''''''''''''QB,VB实用