On Wed, 22 Aug 2012 06:53:55 -0700 (PDT),
(E-Mail Removed) wrote:
>hello
>
>whats the best way to make a number equal to a bigger number?
>
>so say we have:
>
>int one = 1;
>int two = 2;
>int three = 3;
>int biggest;
>
>is there a way to set biggest to whatever number (one, two, three) is biggest?
>
>all I can come up with is a loooong if-else sequence. gotta be a way to do this in a line or two.
>
>ChrisW
biggest = one > two && one > three ? one : two > three ? two : three;
In other words, if the first conditional clause is true, then "one"
must be the biggest. Otherwise either either "two" or "three" or both
are bigger than "one" so the problem reduces to finding the larger of
"two" and "three" which the second conditional determines.
Oz
--
A: Because it fouls the order in which people normally read text.
Q: Why is top-posting such a bad thing?
A: Top-posting.
Q: What is the most annoying thing on usenet and in e-mail?