Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Find highest integer out of 6 existing

Status
Not open for further replies.

MoshiachNow

IS-IT--Management
Feb 6, 2002
1,851
IL
HI,

WHich way would be the simpliest to find which variable out of 6 would hold the biggest integer ?
thanks

Long live king Moshiach !
 
You could loop through each of them and compare them to each other till you get the biggest one, or you could put them in an array and sort them. Do you just need the biggest value or do you need to know which variable contains the biggest value?

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
[noevil]
Travis - Those who say it cannot be done are usually interrupted by someone else doing it; Give the wrong symptoms, get the wrong solutions;
 
I guess I should say.. do you really need the name.. or can you return a new variable that contains the highest value?

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
[noevil]
Travis - Those who say it cannot be done are usually interrupted by someone else doing it; Give the wrong symptoms, get the wrong solutions;
 
use a hash to store the numbers then you can easily get the name of the key with the value you are looking for. Any other way is probably going to be a bad idea.

------------------------------------------
- Kevin, perl coder unexceptional! [wiggle]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top