VB编程,求解,谢谢

2025-03-06 18:33:58
推荐回答(1个)
回答1:

Dim he() As Integer
Private Sub Command2_Click()
Dim x As Integer, y As Integer
    For x = -99 To 99
        For y = -49 To 49
            If (3 * x) - (8 * y) = 100 Then
                ReDim Preserve he(i)
                he(i) = x + y
                i = i + 1
            End If
        Next
    Next
Call bijiao
End Sub
Sub bijiao()
Dim max As Integer, i As Integer
    max = 0
    For i = 0 To UBound(he)
    Print he(i)
        If max < he(i) Then
            max = he(i)
        End If
    Next
    Print "和最大为:"; Str(max)
End Sub