Hello, I'm just doing a small project I need to do for my computing class (It's very basic, sorry) and I'm having a problem with something (which I find embarrassing as to how basic it is.
This is what my code looks like :
However, the maximum value is not displaying, instead just the last value that was entered. What am I doing wrong here?
This is what my code looks like :
Code
Private Sub Verify(ByRef group, ByVal rating, ByVal names, ByVal telephone)
Dim counter As Integer
For counter = 1 To 3
Do
names(counter) = InputBox("Please enter your name")
If names(counter) = "" Then
MsgBox ("Please enter your name")
End If
Loop Until names(counter) <> ""
Do
telephone(counter) = InputBox("Please enter your telephone number")
If telephone(counter) = "" Then
MsgBox ("Please enter your telephone number")
End If
Loop Until telephone(counter) <> ""
Do
group(counter) = InputBox("Please enter your group size (0-20)")
If group(counter) > 20 Then
MsgBox ("Please enter a group size between 0 and 20")
End If
Loop Until group(counter) < 20
Do
rating(counter) = InputBox("Please enter your group rating (0-10)")
If rating(counter) > 10 Then
MsgBox ("Please enter a rating between 0 and 10")
End If
Loop Until rating(counter) < 10
Next counter
Call max(maximum, group)
Call Display(group, rating, names, telephone)
End Sub
Private Sub max(ByRef maximum, ByRef group)
maximum = 0
For counter = 1 To 3
If group(counter) > maximum Then
maximum = group(counter)
End If
Next counter
End Sub
Private Sub Display(ByVal group, ByVal rating, ByVal names, ByVal telephone)
For counter = 1 To 3
PictureDisplay.Print ("Name: " & names(counter))
PictureDisplay.Print ("Telephone Number: " & telephone(counter))
PictureDisplay.Print ("Group Size: " & group(counter))
PictureDisplay.Print ("Group Rating: " & rating(counter))
Next counter
PictureDisplay.Print ("Maximum group size: " & maximum)
Call ask
End SubHowever, the maximum value is not displaying, instead just the last value that was entered. What am I doing wrong here?


