Presented By:
Conditional / Ternary Operator
Muhammad Waseem
 General form is,
(expression 1?expression 2: expression3);
 Conditional operators ?and :are sometimescalled
ternary operators
 if expression 1is true, then the value returned will be
expression 2, otherwise the value returned will be
expression 3
Syntax
Exampleprogram
main( )
{
int sal;
cout<<“enter salary”;
cin>>sal
(sal <40000) ?cout<< "Manager" :cout<<“Clerk”;
}
Conditional operator/Ternary Operator in c/C++

Conditional operator/Ternary Operator in c/C++