+ 1
given three integer numbers and knowing that they form a valid triangle as (int side1, int side2, int side3), how can I use c++ library function max () to write a single statement that assigns the maximum of three sides to the variable sidemax;
2 Answers
+ 3
I don't know about the max() function but assuming it gives the maximum of two variables...
sidemax = max(max(side1, side2), side3) ;
0
will this work?
sidemax = max((side1>side2:side1,side2),side3);