0

C++

this is another way of writing code instead of using nested if else statements. i think the syntax if like this if ( a < b ) { a = b; } else { a = -b; } So please explain to me how it works i dont understand.

26th May 2017, 11:44 AM
Dimpho
1 Réponse
+ 3
use ternary operator e.g. condition?value if true: value if false a>b ? a=b : a=-b
28th May 2017, 8:32 PM
Gurpreet Singh
Gurpreet Singh - avatar