vb矩阵转置
vb随机产生一个6行4列的矩阵在图片框1中输出,再将其转置(4行6列)在图片框2输出,程序如图...
vb随机产生一个6行4列的矩阵在图片框1中输出,再将其转置(4行6列)在图片框2输出,程序如图
展开
2个回答
展开全部
Dim a(6, 6) As Integer, i As Integer, ii As Integer
Private Sub Command1_Click()
For i = 1 To 6
For ii = 1 To 4
a(i, ii) = Int(Rnd * 90 + 10)
Next ii
Next i
For i = 1 To 6
For ii = 1 To 4
Picture1.Print a(i, ii);
Next ii
Picture1.Print ""
Next i
End Sub
Private Sub Command2_Click()
For ii = 1 To 4
For i = 1 To 6
Picture2.Print a(i, ii);
Next i
Picture2.Print
Next ii
End Sub
展开全部
Option Explicit
Private Sub Command1_Click()
Text1.Text = ""
Text2.Text = ""
Dim i As Integer
For i = 1 To 24
Text1.Text = Text1 & Int(Rnd * 90) + 10 & " "
If i Mod 4 = 0 Then Text1.Text = Text1.Text & vbCrLf & vbCrLf
Next
End Sub
Private Sub Command2_Click()
Dim a, b, c As Integer, d As Integer
a = Split(Text1.Text, vbCrLf & vbCrLf)
For c = 0 To 3
For d = 0 To 5
b = Split(a(d))
Text2.Text = Text2.Text & b(c) & " "
Next
Text2.Text = Text2.Text & vbCrLf & vbCrLf
Next
End Sub
Private Sub Form_Load()
Text1.Text = ""
Text2.Text = ""
End Sub
Private Sub Command1_Click()
Text1.Text = ""
Text2.Text = ""
Dim i As Integer
For i = 1 To 24
Text1.Text = Text1 & Int(Rnd * 90) + 10 & " "
If i Mod 4 = 0 Then Text1.Text = Text1.Text & vbCrLf & vbCrLf
Next
End Sub
Private Sub Command2_Click()
Dim a, b, c As Integer, d As Integer
a = Split(Text1.Text, vbCrLf & vbCrLf)
For c = 0 To 3
For d = 0 To 5
b = Split(a(d))
Text2.Text = Text2.Text & b(c) & " "
Next
Text2.Text = Text2.Text & vbCrLf & vbCrLf
Next
End Sub
Private Sub Form_Load()
Text1.Text = ""
Text2.Text = ""
End Sub
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询