adsense


Saturday, 21 November 2015

C++ LANGUAGE THE ? : OPERATORS PAGE 64

COMPUTER LANGUAGES HTML,C,C++.JAVA,.NET AND MULTIMEDIA basics and programs click home button



C++ LANGUAGE THE ? : OPERATORS






The ? : Operator 


We have covered conditional operator “? :” in previous chapter 
which can be used to replace if...else statements. It has the 
following general form: 

Exp1 ? Exp2 : Exp3; 

Exp1, Exp2, and Exp3 are expressions. Notice the use 
and placement of the colon. 
The value of a ‘?’ expression is determined like this: 
Exp1 is evaluated. If it is true, then Exp2 is evaluated 
and becomes the value of the entire ‘?’ expression. 
If Exp1 is false, then Exp3 is evaluated and its value 
becomes the value of the expression. 
 
 
 
 
 




No comments: