vb中二维数组元素怎么去掉某一行某一列然后输出
1个回答
展开全部
Dim Suju(3, 4) As Integer
Private Sub Command1_Click()
Randomize
Text1 = ""
For i = 0 To 3
For j = 0 To 4
Suju(i, j) = Rnd * 89 + 10
Text1 = Text1 & " " & Suju(i, j)
Next
Text1 = Text1 & vbCrLf
Next
Picture1.Cls
Picture1.Print Smax(Suju)
End Sub
Function Smax(Sj() As Integer) As String
Dim aa As Integer
Dim bb As String
aa = Suju(0, 0)
For i = 0 To UBound(Sj, 1)
For j = 0 To UBound(Sj, 2)
If aa < Sj(i, j) Then aa = Sj(i, j)
Next
Next
For i = 0 To UBound(Sj, 1)
For j = 0 To UBound(Sj, 2)
If aa = Sj(i, j) Then
bb = bb & vbCrLf & "在第" & i + 1 & "行,第" & j + 1 & "列"
End If
Next
Next
Smax = "最大值是:" & aa & bb
End Function
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询