I have written a program in visual basic and want it to display the maximum value that is entered into an array. Sometimes the same value will be entered 2 or more times and I need some way of detecting this and informing the user of it, at the end of the program.
Currently I am performing a find max then doing linear search through array items. If the item is = to the max then I set an array boolean flag to true. Only problem I have is displaying the multi max as I need to use the positions in the boolean array to detect which items in the values array appeared equal max number of times, if that makes sense. Is it possible to perform a fixed loop of a MsgBox(“…”) without repeating the text, just altering the value of i(the position in the values array being accessed).
Thanks in advance.
EDIT
Code from comment
max=0
for i = 1 to 4
if number(i)>number(max) then max=i
next
for i = 0 to 4
if number(i)=number(max) then flag(i)=true
next
Msgbox("the biggest number you entered was" & number(max))
Not tested…