Is there an easy/quick way to get the hightest of a couple of intenger/real.
Like i got 7 Intengers with: 4,1,6,3,8,3,9 And I want to know what intenger is the highest!
On a serious note though, it seems to be possible to sort variables - though I personally haven't learned how. This post contains some info on it, it's from a thread I made a week back.
Loop through the array containing the values multiple times, each time checking so that each value is greater than the one before it. Swap the values if they don't. If no values are swapped in a full loop, you have successfully sorted your array.
I can modify the map I posted in that other thread to match this scenario if you need help understanding it. Just let me know how your variables are set up so I have something to work with.
Why do you want to sort the entire array if you only want to get the highest number?
LocalvariableshighestNumber=0<Integer>ActionshighestNumber=Numbers[1]
Loop - Pick Each Integer from 2 to MaxIndex and do actions:
If Numbers[(PickedInteger)] > highestNumber then
highestNumber = Numbers[(PickedInteger)]
Else
Yup, true. I didn't really think since I answered a similar question before. (I blame Zinatic for reminding me of that old topic, heh). Went on auto pilot answer mode. ;)
Well, I found a way but I just thought there must be a more easy, faster way to do it...
@s3rius: That will give me the highest number but not "the source" of the number, the intenger where the number comes from, you know?^^
But nvm I got my own way, just wondered if there's a function I havent discovered yet.
Hey Guys!
Is there an easy/quick way to get the hightest of a couple of intenger/real. Like i got 7 Intengers with: 4,1,6,3,8,3,9 And I want to know what intenger is the highest!
@TerrorGurke: Go
9.
On a serious note though, it seems to be possible to sort variables - though I personally haven't learned how. This post contains some info on it, it's from a thread I made a week back.
Loop through the array containing the values multiple times, each time checking so that each value is greater than the one before it. Swap the values if they don't. If no values are swapped in a full loop, you have successfully sorted your array.
I can modify the map I posted in that other thread to match this scenario if you need help understanding it. Just let me know how your variables are set up so I have something to work with.
Why do you want to sort the entire array if you only want to get the highest number?
Yup, true. I didn't really think since I answered a similar question before. (I blame Zinatic for reminding me of that old topic, heh). Went on auto pilot answer mode. ;)
Well, I found a way but I just thought there must be a more easy, faster way to do it... @s3rius: That will give me the highest number but not "the source" of the number, the intenger where the number comes from, you know?^^
But nvm I got my own way, just wondered if there's a function I havent discovered yet.
Thanks
Alternative solution:
"index of highest number" is what you would call the "source".
Uhm, you forgot an if condition. Your index of highest number will always be 9 with that code.