重庆分公司,新征程启航
为企业提供网站建设、域名注册、服务器等服务
for i = 0 to 3
在江都等地区,都构建了全面的区域性战略布局,加强发展的系统性、市场前瞻性、产品创新能力,以专注、极致的服务理念,为客户提供成都网站设计、网站制作 网站设计制作按需定制制作,公司网站建设,企业网站建设,品牌网站建设,全网营销推广,外贸网站制作,江都网站建设费用合理。
textbox_未知.text = a(i,1) a(i,2) a(i,3) a(i,4) vbcrlf
next
如果我吧长宽弄反了自行转正,
如果要间隔,请插入 VBtab
VB源程序如下:
Option Base 1
Private Sub Command1_Click()
Dim A(5, 5) As Integer, B(5, 5) As Integer
For x = 1 To 5
For y = 1 To 5
A(x, y) = Int(10 + Rnd * 90) '随机产生两位数的整数
Print A(x, y); '输出
Next
Next
For x = 1 To 5
For y = 1 To 5
B(x, y) = A(y, x) '转置
Print B(x, y); '输出
Next
Next
End Sub
程序输出结果如下:
扩展资料:
VB:编写程序,实现如下规律的5*5矩阵存入数组,并输出该数组
Private Sub Command1_Click()
Dim a(1 To 6, 1 To 6) As Integer
For i = 1 To 5
For j = 1 To 5
tmp = 99
If i tmp Then
tmp = i
End If
If j tmp Then
tmp = j
End If
If 6 - i tmp Then
tmp = 6 - i
End If
If 6 - j tmp Then
tmp = 6 - j
End If
a(i, j) = tmp
Next j
Next i
For i = 1 To 5
For j = 1 To 5
Picture1.Print Tab(j * 5); a(i, j);
Next j
Picture1.Print
Next i
End Sub
程序输出结果如下:
Private Sub Command1_Click()
Dim a(1 To 3, 1 To 5) As Integer, b(1 To 5, 1 To 3) As Integer
Cls
Print "产生的A数组:"
For i = 1 To 3
For j = 1 To 5
a(i, j) = Int(Rnd * 100)
Print a(i, j);
Next j
Next i
zhuanzhi a, b
Print "转置后的B数组:"
For i = 1 To 5
For j = 1 To 3
Print b(i, j);
Next j
Next i
End Sub
Sub zhuanzhi(ByRef a() As Integer, ByRef b() As Integer)
For i = LBound(a, 1) To UBound(a, 1)
For j = LBound(a, 2) To UBound(a, 2)
b(j, i) = a(i, j)
Next j
Next i
End Sub