C++ Part 17

Boolean Expressions

A Boolean expression is any expression that is either true or false.


AND Example
(2 < x) && (x < 7)  
 

And Example with IF AND ELSE
if ( (score > 0) && (score < 10))
cout << "score is between 0 and 10.\n";
else
cout << "score is not between 0 and 10.\n";  

 
OR Example
(y < 0)||(y < 12)  
Precede Order:

If one operation is performed before another, the operation that is performed first
is said to have higher precedence.
Post a Comment

Popular Posts