Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
I have 6 varibles that need to be compared and I need the ones with the highest value to do somethings, how do I just find the 2 with the highest value or compared the 6 and find the highest and second highest???
//Pass 1 get the highest...
set high = a
if(b > high)
high = b
if(c > high)
high = c
if(d > high)
high = d
if(e > high)
high = e
if(f > high)
high = f
//Pass 2 check to see if there are 2 equal high values
count=0;
if(a == high)count++
if(b == high)count++
if(c == high)count++
if(d == high)count++
if(e == high)count++
if(f == high)count++
if(count > 1) high2 = high
else
if(a != high) high2 = a
if(b != high and b > high2) high2 = b
if(c != high and c > high2) high2 = c
if(d != high and d > high2) high2 = d
if(e != high and e > high2) high2 = e
if(f != high and f > high2) high2 = f
first = num[0];
second = num[0];
for (int i = 1; i <= max; i++)
{
if num[i] > first
{
second = first;
first = num[i];
}
elseif num[i] > second
{
second = num[i];
}
}
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.