用VB编写一个4*4的随机二位整数矩阵并实现矩阵的转置图片框形式
1个回答
展开全部
Option Explicit
Option Base 1
Dim A(4, 4) As Integer
Private Sub Command1_Click()
Randomize
Dim i As Integer, j As Integer
For i = 1 To 4
For j = 1 To 4
A(i, j) = Int(Rnd * 90) + 10
Text1.Text = Text1.Text & Str(A(i, j)) & " "
Next j
Text1.Text = Text1.Text & vbCrLf
Next i
End Sub
Private Sub Command2_Click()
Dim i As Integer, j As Integer
Dim b(4, 4) As Integer
For i = 1 To 4
For j = 1 To 4
b(i, j) = A(j, i)
Next j
Next i
For i = 1 To 4
For j = 1 To 4
Text2.Text = Text2.Text & Str(b(i, j)) & " "
Next j
Text2.Text = Text2.Text & vbCrLf
Next i
End Sub
Private Sub Command3_Click()
End
End Sub
Option Base 1
Dim A(4, 4) As Integer
Private Sub Command1_Click()
Randomize
Dim i As Integer, j As Integer
For i = 1 To 4
For j = 1 To 4
A(i, j) = Int(Rnd * 90) + 10
Text1.Text = Text1.Text & Str(A(i, j)) & " "
Next j
Text1.Text = Text1.Text & vbCrLf
Next i
End Sub
Private Sub Command2_Click()
Dim i As Integer, j As Integer
Dim b(4, 4) As Integer
For i = 1 To 4
For j = 1 To 4
b(i, j) = A(j, i)
Next j
Next i
For i = 1 To 4
For j = 1 To 4
Text2.Text = Text2.Text & Str(b(i, j)) & " "
Next j
Text2.Text = Text2.Text & vbCrLf
Next i
End Sub
Private Sub Command3_Click()
End
End Sub
追问
能用VB.NET2008编写吗
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询