Video tutorial to find the biggest of the three integer numbers in C++, using if-else control statements and Ternary Operator.
Before watching this video, please make sure to watch and understand this short video: Find Biggest of 3 Numbers: C++
Full Source Code
In this program we take 3 integer values from the user and using ternary operator decide the biggest of 3 numbers.
int big = ( a>b && a>c )?a:(b>c?b:c); |
if ( a > b && a > c ) is true, then value of a will be stored in variable big; else ( b > c ? b : c ) will be evaluated. Here, if value of b is greater than c, value of b will be stored in variable big else value of c will be stored in the variable big.
Video Tutorial: Biggest of 3 Integer Numbers
Output
Enter 3 no’s
10
20
30
Among 10, 20, 30 Biggest is 30