HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

How to get maximum integer

06-11-2009, 12:09 PM#1
DanThanh
Hiho !
I have five integers (a, b, c, d, e)
How can i get the maximum integer ? (I use it for my Hero Arena map)
06-11-2009, 12:13 PM#2
Anachron
I would suggest this:
Collapse JASS:
Array[0] = a
Array[1] = b
Array[2] = c
Array[3] = d
Array[4] = e

tmpValue = 0
highestValue = 0

i = 0
loop
   exitwhen i > 4
   set i = i + 1
   if Array[i] > tmpValue then
         set tmpValue = Array[i]
         set highestValue = i
   endif
endloop

This should work
06-11-2009, 12:14 PM#3
cohadar
integer max5 = IMaxBJ(IMaxBJ(IMaxBJ(IMaxBJ(a,b),c),d),e)
06-11-2009, 12:17 PM#4
Anachron
Didn't know that function. Why BJ? Is there no anti-bj native?
06-11-2009, 01:04 PM#5
Fledermaus
Not all BJs are evil.
06-11-2009, 11:42 PM#6
DanThanh
Quote:
Originally Posted by Anachron
Didn't know that function. Why BJ? Is there no anti-bj native?

Yah, i've never heard of it
Cohadar >> outstanding :)

I also love the way of Anachron. yes, both ways works just well, thanks people !