vb实验E
- 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
- 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
- 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。
Dim a%(3, 3), b%(3, 3)
Private Sub Command1_Click()
Picture1.Cls
For i = 0 To 3
For j = 0 To 3
Picture1.Print a(i, j); "";
Next j
Picture1.Print
Next i
End Sub
Private Sub Command2_Click()
Picture2.Cls
For i = 0 To 3
For j = 0 To 3
Picture2.Print b(i, j); "";
Next j
Picture2.Print
Next i
End Sub
Private Sub Command3_Click()
Picture3.Cls
sa = 0
For i = 0 To 3
sa = sa + a(i, j)
Next i
sb = 0
For i = 0 To 3
sb = sb + b(i, j)
Next i
Picture3.Print "A数组主对角线元素和为:"; sa Picture3.Print "B数组主对角线元素和为:"; sb
End Sub
Private Sub Form_Load()
For i = 0 To 3
For j = 0 To 3
a(i, j) = Int(Rnd * 36 + 35)
b(i, j) = Int(Rnd * 41 + 100)
Next j
End Sub
第二个
Dim a%(3, 3), b%(3, 3), c(3, 3)
Private Sub Command1_Click() Picture1.Cls
For i = 0 To 3
For j = 0 To 3
Picture1.Print a(i, j); "";
Next j
Picture1.Print
Next i
End Sub
Private Sub Command2_Click() Picture2.Cls
For i = 0 To 3
For j = 0 To 3
Picture2.Print b(i, j); "";
Next j
Picture2.Print
Next i
End Sub
Private Sub Command3_Click() Picture3.Cls
For i = 0 To 3
For j = 0 To 3
c(i, j) = a(i, j) + b(i, j)
Picture3.Print c(i, j); "";
Next j
Picture3.Print
Next i
End Sub
Private Sub Form_Load()
For i = 0 To 3
For j = 0 To 3
a(i, j) = Int(Rnd * 36 + 35)
b(i, j) = Int(Rnd * 41 + 100)
Next i End Sub