十年网站开发经验 + 多家企业客户 + 靠谱的建站团队
量身定制 + 运营维护+专业推广+无忧售后,网站问题一站解决
Option Explicit
昆明网站制作公司哪家好,找成都创新互联公司!从网页设计、网站建设、微信开发、APP开发、响应式网站建设等网站项目制作,到程序开发,运营维护。成都创新互联公司从2013年创立到现在10年的时间,我们拥有了丰富的建站经验和运维经验,来保证我们的工作的顺利进行。专注于网站建设就选成都创新互联公司。
Option Base 1
Dim a(4, 4) As Integer
Private Sub Command1_Click()
Dim i As Integer, j As Integer
Picture1.Cls
Randomize
For i = 1 To 4
For j = 1 To 4
a(i, j) = Int(Rnd * 9) + 1
Picture1.Print a(i, j);
Next j
Picture1.Print
Next i
End Sub
Private Sub Command2_Click()
Dim i As Integer, j As Integer
Dim b(4, 4) As Integer
Picture2.Cls
For i = 1 To 4
For j = 1 To 4
b(i, j) = a(j, i)
Picture2.Print b(i, j);
Next j
Picture2.Print
Next i
End Sub
Private Sub Command3_Click()
Dim i As Integer, j As Integer, temp As Integer
Picture2.Cls
For i = 1 To 4
For j = i To 4
temp = a(i, j)
a(i, j) = a(j, i)
a(j, i) = temp
Next j
Next i
For i = 1 To 4
For j = 1 To 4
Picture2.Print a(i, j);
Next j
Picture2.Print
Next i
End Sub
在程序设计语言里,用二维数组来保存矩阵的值。
一维列矩阵,就是由:若干行、一列组成的二维数组。
一维行矩阵,就是由:一行、若干列组成的二维数组。
比如一维列矩阵,的输入:
dim a(10,1) as integer '10行,1列
dim i as integer
for i = 1 to 10
a(i,1) = inputbox("")
next i
没错!!
你的算法是:
1.定义三个变量,minValue(放最小值),X(放最小值的X坐标),Y(放最小值的Y坐标)。
2.遍历矩阵。在遍历过程中将最小值放在minValue中,最小值的X坐标放在X中,最小值的Y坐标放在X中。
给你一个函数 Public Sub Vect1XtoVect2(ByVal x1 As Double, ByVal y1 As Double, ByVal z1 As Double, _ ByVal x2 As Double, ByVal y2 As Double, ByVal z2 As Double, _ ByRef xNew As Double, ByRef yNew As Double, ByRef zNew As Double) '矢量叉积 xNew = y1 * z2 - z1 * y2 yNew = z1 * x2 - x1 * z2 zNew = x1 * y2 - y1 * x2 End Sub其中x1,y1,z1为第一个矢量,x2,y2,z2为第二个矢量xnew,ynew,znew为得到的新矢量
'这是在vb6中的代码,在vb.net中基本差不多,你可以参考一下
Private Sub cmdCommand1_Click()
Me.AutoRedraw = True
Dim Grp
Grp = Array(1, 2, 3, 4, 5)
Dim i, j As Long
Dim StrPrt As String
For i = 0 To UBound(Grp)
'i为位移量
StrPrt = ""
For j = i To UBound(Grp)
StrPrt = StrPrt Grp(j)
Next j
For j = 0 To i - 1
StrPrt = StrPrt Grp(j)
Next j
Me.Print StrPrt
Next i
End Sub