+ 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;

15th Jun 2016, 3:56 AM
Abdulai Torfik
2 ответов
+ 3
I don't know about the max() function but assuming it gives the maximum of two variables... sidemax = max(max(side1, side2), side3) ;
15th Jun 2016, 4:44 AM
Sajal Raj Gautam
Sajal Raj Gautam - avatar
0
will this work? sidemax = max((side1>side2:side1,side2),side3);
18th Jun 2016, 6:29 AM
Tushar Purang