随机生成一个三行四列的矩阵 并对其进行转置 并对应的显示在窗体上 用VB编程怎么做 感激不尽 急需答案 谢谢假设有矩阵a,如下;
a(1,1)a(1,2)a(1,3)a(1,4)
a(2,1)a(2,2)a(2,3)a(2,4)
a(3,1)a(3,2)a(3,3)a(3,4)
那么,设a的转置为b,则B如下:
b(1,1)b(1,2)b(1,3)
b(2,1)b(2,2)b(2,3)
b(3,1)b(3,2)b(3,3)
b(4,1)b(4,2)b(4,3)
b矩阵与a矩阵之间元素的关系是:
b(1,1) = a(1,1)
b(1,2) = a(2,1)
b(1,3) = a(3,1)
b(2,1) = a(1,2)
b(2,2) = a(2,2)
b(2,3) = a(3,2)
b(3,1) = a(1,3)
b(3,2) = a(2,3)
b(3,3) = a(3,3)
b(4,1) = a(1,4)
b(4,2) = a(2,4)
b(4,3) = a(3,4)
VB代码如下:
Private Sub Command1_Click()
Dim a(1 To 3, 1 To 4) As Integer
Dim b(1 To 4, 1 To 3) As Integer
Dim h As Integer
Dim L As Integer
Dim x As Integer
'用随机数创建a数组
Randomize
For h = 1 To 3
For L = 1 To 4
a(h, L) = Int((100 * Rnd) + 1)'生成 1 到 100 之间的随机数值
Next L
Next h
'显示数组a
Print "显示数组(矩阵)a"
【矩阵转置vb.net代码 矩阵转置程序代码】For h = 1 To 3
For L = 1 To 4
Print Tab((L - 1) * 6); a(h, L);
Next L
Print
Next h
'求数组(矩阵)a的转置b
For h = 1 To 3
For L = 1 To 4
b(L, h) = a(h, L)
Next L
Next h
Print
'显示数组b
Print "显示数组(矩阵)b"
For h = 1 To 4
For L = 1 To 3
Print Tab((L - 1) * 6); b(h, L);
Next L
Print
Next h
End Sub
求助,初学者想问VB.NET,怎么输入一维列矩阵或者一维行矩阵怎么转置成一维列矩阵?谢谢了!在程序设计语言里矩阵转置vb.net代码,用二维数组来保存矩阵矩阵转置vb.net代码的值 。
一维列矩阵矩阵转置vb.net代码,就是由矩阵转置vb.net代码:若干行、一列组成的二维数组 。
一维行矩阵 , 就是由:一行、若干列组成的二维数组 。
比如一维列矩阵,的输入:
dima(10,1) as integer'10行,1列
dim i as integer
for i = 1 to 10
a(i,1) = inputbox("")
next i
vb矩阵转置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
VB编程,应用二维数组产生随机矩阵5*5,并实现矩阵的转置 。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
Print
Next
Print
For x = 1 To 5
For y = 1 To 5
B(x, y) = A(y, x) '转置
Print B(x, y); '输出
Next
Print
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 itmp Then
tmp = i
End If
If jtmp Then
tmp = j
End If
If 6 - itmp Then
tmp = 6 - i
End If
If 6 - jtmp Then
tmp = 6 - j
End If
a(i, j) = tmp
Next j
Next i
For i = 1 To 5
推荐阅读
- html5打开页面弹出键盘,html打开页面弹出一个窗口
- 怎么用python提取fasta序列,python提取数据
- 微信视频号怎样拉黑对方,微信视频号怎么拉黑一个人
- 怎么将微信直播视频下载,如何将微信直播视频下载下来
- 函数引用c语言 c语言函数引用的用法
- erp系统功能模块实训,erp系统功能模块图
- 微信可以看好友直播回放吗,微信可以看好友直播回放吗安全吗
- java实体类代码 java实体类设计技巧
- 包含如何为商家做广告优化推广的词条