vb编程利用随机数生成两个矩阵(数据不一定相同,前者范围为30~90,后者为101~135) 要求 1.将两个矩阵结果放
来源:学生作业帮 编辑:神马作文网作业帮 分类:综合作业 时间:2024/11/12 08:52:40
vb编程利用随机数生成两个矩阵(数据不一定相同,前者范围为30~90,后者为101~135) 要求 1.将两个矩阵结果放入C矩阵中 2.将A矩阵转置 3.求C矩阵中元素的最大值和下标 4.以下三角形式显示A矩阵,上三角形式显示B矩阵 5.将A矩阵第1行与第三行对应元素交换位置,即第一行元素放到第三行,第三行元素放到第一行 6.求A矩阵两条对角线元素之和 7.将A矩阵按列的次序把各元素放入一维数组D中,显示结果
Option Explicit
Sub SShow(A() As Integer)
Dim I, J
For I = 1 To 4
For J = 1 To 4
Print A(I, J);
Next
Print
Next
End Sub
Private Sub Form_Click()
Dim A(1 To 4, 1 To 4) As Integer
Dim B(1 To 4, 1 To 4) As Integer
Dim I As Integer, J As Integer, T As Integer
Dim L As Integer, U As Integer
L = 30
U = 70
Randomize
For I = 1 To 4
For J = 1 To 4
A(I, J) = Int((U - L + 1) * Rnd + L)
Next
Next
L = 101
U = 135
Randomize
For I = 1 To 4
For J = 1 To 4
B(I, J) = Int((U - L + 1) * Rnd + L)
Next
Next
Print "A:"
SShow A
Print "B:"
SShow B
Dim C(1 To 4, 1 To 4) As Integer
For I = 1 To 4
For J = 1 To 4
C(I, J) = A(I, J) + B(I, J)
Next
Next
Print "C:"
SShow C
For I = 1 To 4
For J = I To 4
T = A(I, J): A(I, J) = A(J, I): A(J, I) = T
Next
Next
Print "A':"
SShow A
Dim R1, C1, Max
Max = C(1, 1)
For I = 1 To 4
For J = 1 To 4
If Max < C(I, J) Then
Max = C(I, J)
R1 = I
C1 = J
End If
Next
Next
Print "C: MAX=" & Max & " 行:" & R1 & " 列:" & C1
Print "A:"
For I = 1 To 4
For J = 1 To I
Print A(I, J);
Next
Print
Next
Print "B:"
For I = 1 To 4
Print Space((I - 1) * 5);
For J = I To 4
Print B(I, J);
Next
Print
Next
For J = 1 To 4
T = B(1, J): B(1, J) = B(3, J): B(3, J) = T
Next
Print "B:"
SShow B
End Sub
这个问题你可以去搜索一下编,程,回,忆,录,之unity3d.零基础开始学起,就算是菜鸟都能看懂
再问: 多谢啦
Sub SShow(A() As Integer)
Dim I, J
For I = 1 To 4
For J = 1 To 4
Print A(I, J);
Next
Next
End Sub
Private Sub Form_Click()
Dim A(1 To 4, 1 To 4) As Integer
Dim B(1 To 4, 1 To 4) As Integer
Dim I As Integer, J As Integer, T As Integer
Dim L As Integer, U As Integer
L = 30
U = 70
Randomize
For I = 1 To 4
For J = 1 To 4
A(I, J) = Int((U - L + 1) * Rnd + L)
Next
Next
L = 101
U = 135
Randomize
For I = 1 To 4
For J = 1 To 4
B(I, J) = Int((U - L + 1) * Rnd + L)
Next
Next
Print "A:"
SShow A
Print "B:"
SShow B
Dim C(1 To 4, 1 To 4) As Integer
For I = 1 To 4
For J = 1 To 4
C(I, J) = A(I, J) + B(I, J)
Next
Next
Print "C:"
SShow C
For I = 1 To 4
For J = I To 4
T = A(I, J): A(I, J) = A(J, I): A(J, I) = T
Next
Next
Print "A':"
SShow A
Dim R1, C1, Max
Max = C(1, 1)
For I = 1 To 4
For J = 1 To 4
If Max < C(I, J) Then
Max = C(I, J)
R1 = I
C1 = J
End If
Next
Next
Print "C: MAX=" & Max & " 行:" & R1 & " 列:" & C1
Print "A:"
For I = 1 To 4
For J = 1 To I
Print A(I, J);
Next
Next
Print "B:"
For I = 1 To 4
Print Space((I - 1) * 5);
For J = I To 4
Print B(I, J);
Next
Next
For J = 1 To 4
T = B(1, J): B(1, J) = B(3, J): B(3, J) = T
Next
Print "B:"
SShow B
End Sub
这个问题你可以去搜索一下编,程,回,忆,录,之unity3d.零基础开始学起,就算是菜鸟都能看懂
再问: 多谢啦
生成并输出两个3×3的矩阵(每个元素均为1-99的随机数),计算两个矩阵的乘积.在Java 中编程
在VB中随机生成两个4*4矩阵,A矩阵范围30~70,B矩阵101~135(第二版书上习题第五章8题)
编程实现两个N*N矩阵相乘,并输出实验结构矩阵元素为整型数据.用c语言编程
VB编程随机生成两个3*3的矩阵A和B.
在MATLAB中的两个矩阵中,怎么当一个矩阵的数据出现0时,另一个矩阵相同位置的数据也要为0
c++编程题 建立一个矩阵array类,存储一个4*4的矩阵并将两个矩阵相加(对应元素相加)生成第三个矩阵.
VB编程,“数组问题”窗口利用随机函数随机产生两个两位数的5×5矩阵并作运算...
实验项目:实现矩阵的加与乘操作.实验要求:定义两个n乘n矩阵,编程计算两个矩阵现价与相乘的结果.
利用matlab将矩阵随即分成两个矩阵
两个矩阵a 和b 的乘积,结果为c 矩阵,求c 语言程序!
求VB编程:给一个5*5的矩阵赋值,要求矩阵副对角线上方元素都是偶数,副对角线和它下方元素都为奇数.
opencv中如何将两个类型为Mat的矩阵合为一个矩阵?