Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Newcomers DBPro Corner / largest and smallest number in array

Author
Message
Garion
16
Years of Service
User Offline
Joined: 7th Dec 2007
Location: Poland
Posted: 31st Jan 2009 21:46 Edited at: 31st Jan 2009 21:47
Like in the topic title. I have an array of integers and have to find out what's the largest and the smallest one in it. The array is a collection of point coordinates, shape(ID).x and shape(ID).y

What command could I use? Or must I do it in a loop to find the largest and smallest y and x?

thanks for help

edit:
of course I ment * number in the title
AndrewT
17
Years of Service
User Offline
Joined: 11th Feb 2007
Location: MI, USA
Posted: 31st Jan 2009 22:33
You can just loop through the array with a For-Next loop and check each X and Y coordinate:



IanM
Retired Moderator
22
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 31st Jan 2009 22:44
Actually, that could fail if your starting mins/max's are not 'extreme' enough for the coordinates you pass in the array.

There's a simple way to fix it though. Just set your mins/max's to match the first values in the array, then loop though the rest:


Garion
16
Years of Service
User Offline
Joined: 7th Dec 2007
Location: Poland
Posted: 1st Feb 2009 00:33
I see, thank You very much *bows*

Login to post a reply

Server time is: 2024-11-24 15:05:29
Your offset time is: 2024-11-24 15:05:29