vb程序设计里的题!感谢大家了!
1个回答
展开全部
程序编写写成了,已经运行过:
Private Sub Form_Click()
Cls
Dim a(6, 6) As Integer
Dim i As Integer, j As Integer
For i = 1 To 6
For j = 1 To 6
If i = j Or i + j = 7 Then
a(i, j) = 1
Else
a(i, j) = Int(Rnd() * 29 + 1)
End If
Next
Next
Print "产生的6*6随机数组是:"
For i = 1 To 6
For j = 1 To 6
Print Format(a(i, j), "00"); " ";
Next
Next
Print "各行平均值为:"
Dim b(6) As Single
Dim min As Integer, max As Integer
For i = 1 To 6
For j = 1 To 6
b(i) = b(i) + a(i, j)
Next
b(i) = b(i) / 6
Print b(i);
Next
min = 1
max = 1
For i = 2 To 6
If b(i) < b(min) Then min = i
If b(i) > b(max) Then max = i
Next
Print "平均值最大的是第"; max; "行"
Print "平均值最小的是第"; min; "行"
End Sub
有什么问题请留言。
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询