I need to find the 2 highest numbers on an array of numbers. I can't use the sorting fiture.
Any help will be appreciated,

Thanks
Carmen

Initialize highval and secondhighval to a value that is lower than any possible value in the data.
Then, iterate through the array with the following logic:

If curval > highval Then
secondhighval = highval
highval = curval
Else If curval > secondhighval Then
secondhighval = curval
End If

After you have iterated through all of the data, if highval and secondhighval both have valid values, you will have found the two highest values.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.