Private
成都創(chuàng)新互聯(lián)憑借在網(wǎng)站建設、網(wǎng)站推廣領域領先的技術能力和多年的行業(yè)經(jīng)驗,為客戶提供超值的營銷型網(wǎng)站建設服務,我們始終認為:好的營銷型網(wǎng)站就是好的業(yè)務員。我們已成功為企業(yè)單位、個人等客戶提供了成都網(wǎng)站設計、成都做網(wǎng)站服務,以良好的商業(yè)信譽,完善的服務及深厚的技術力量處于同行領先地位。
Sub
Command1_Click()
Dim
a(4,
4)
As
Integer,
b(4,
4)
As
Integer,
c(4,
4)
As
Single,
s
As
Long,
d(16)
As
Integer
m1%
=
1:
m2%
=
1:
l1%
=
1:
l2%
=
1
Randomize
For
i
=
1
To
4
For
t
=
1
To
4
a(i,
t)
=
Int(Rnd(1)
*
9
+
1)
If
i
=
t
Or
i
+
t
=
5
Then
s
=
s
+
a(i,
t)
'對角線元素值累加
d(i
+
(t
-
1)
*
4)
=
a(i,
t)
'按列放入D
b(i,
t)
=
Int(Rnd(1)
*
11
+
10)
c(i,
t)
=
a(i,
t)
*
b(i,
t)
'乘法
If
c(i,
t)
c(l1,
l2)
Then
l1
=
i:
l2
=
t
'求最大數(shù)組下標
If
c(i,
t)
c(m1,
m2)
Then
m1
=
i:
m2
=
t
'求最小數(shù)組下標
Next
Next
"最大值";
c(l1,
l2);
"下標";
l1;
",";
l2
"最小值";
c(m1,
m2);
"下標";
m1;
",";
m2
"A兩條對角線平均值";
s
/
8
"D的結果為:";
'打印D
For
i
=
1
To
16
Str(d(i));
Next
End
Sub
要實現(xiàn)什么樣的功能呢?矩陣就是二維表吧,在.Net中有許多方法可以實現(xiàn)二維表,根據(jù)不同的需求選擇適合的方法,你應該詳細一點說明
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
MsgBox(Int(Rnd() * 10))
Dim n As Integer = 4
Dim i, a As Integer
Dim r As String
Randomize()
For i = 1 To n
r = Int(Rnd() * 10)
Label1.Text = Space(n - i + 1) StrDup(i, r) + vbNewLine
Next i
For i = n To 1 Step -1
r = Int(Rnd() * 10)
Label1.Text = Space(n - i + 1) StrDup(i, r) + vbNewLine
Next i
For Each c In Label1.Text
If IsNumeric(c) Then
a += 1
End If
Next
MsgBox(a) ‘主對角線和次對角線上各元素之和
End Sub
另一個矩陣也是用同樣方法.
你說的是不是這樣?