高校等考试题天天练二级VB]11月5日
分类: 计算机
时间: 2023-04-17 20:00:29
作者: 全国等级考试资料网
知识点:程序问答(五)
程序
Private Sub Command1_Click()
Dim a(3, 4) As Integer
For m = 1 To 3
For n = 1 To 3
a(m, n) = Int(100 * Rnd)
Next n
Next m
For m = 1 To 3
a(m, 4) = amax(a, m)
Next m
For m = 1 To 3
For n = 1 To 4
Print a(m, n);
Next n
Print
Next m
End Sub
Private Function amax(b, m)
amax = b(m, 1)
For n = 2 To 3
If amax < b(m, n) Then amax = b(m, n)
Next n
End Function
问题3:对于二维数组a,每行最后一列元素用来存放该行数据的什么统计结果?(3分)
问题4:自定义函数amax的功能是什么?(3分)
程序
Private Sub Command1_Click()
Dim a(3, 4) As Integer
For m = 1 To 3
For n = 1 To 3
a(m, n) = Int(100 * Rnd)
Next n
Next m
For m = 1 To 3
a(m, 4) = amax(a, m)
Next m
For m = 1 To 3
For n = 1 To 4
Print a(m, n);
Next n
Next m
End Sub
Private Function amax(b, m)
amax = b(m, 1)
For n = 2 To 3
If amax < b(m, n) Then amax = b(m, n)
Next n
End Function
问题3:对于二维数组a,每行最后一列元素用来存放该行数据的什么统计结果?(3分)
问题4:自定义函数amax的功能是什么?(3分)