Finding two highest numbers.

I'm trying to figure out the two highest numbers of an array.
Without sorting them and only using one loop.
I know how to find the highest, but then how do i skip that number then check for the next highest.
It is very simple. All that you need is to write the corresponding algorithm.:)

Something as

int max1, max2;

max1 = max2 = a[0];

And then you should compare every next element of the array with max1 and then with max2.:)
Topic archived. No new replies allowed.