*****因为VB数组不能根据变量定义,所以本例开始定义一个足够大的数组空间,另一种是循环定义变量产生数据空间
Dim arrA(1000, 1000), arrB(1000, 1000)
n = Val(InputBox("输入n"))
m = Val(InputBox("输入m"))
If n >= 1000 Or m >= 1000 Then MsgBox "行列不要大过1000"
'***产生矩阵
Print "转换前"
For i = 1 To n
For j = 1 To m
arrA(i, j) = Int(Rnd * 10)
Print arrA(i, j) & " ";
Next
Next
'‘**交换
For i = 1 To n
For j = 1 To m
arrB(j, i) = arrA(i, j)
Next
Next
Print "转换后"
'****输出
For i = 1 To m
For j = 1 To n
Print arrB(i, j) & " ";
Next
Next