CPP conditions

Evaluation of Conditions

Any program is meant to do some actions based on conditions.

These conditions is normally based on an evaluation of expressions using Relational Operators which in C++ are:

Name Operator Sample Evaluates to
Equals == 200/2 == 120*2
20*10 == 200
false
true
Not Equals != 200/2 != 120*2
20*10 != 200
true
false
Greater then > 200/2 > 120*2
20*20 > 200
false
true
Less then < 200/2 < 120*2
20*20 < 200
true
false
Greater then or equal to >= 200/2 >= 120*2
20*20 >= 200
false
true
Less then or equal to <= 200/2 <= 120*2
20*20 <= 200
true
false
  • In such evaluation we can use some Logical Operators as well:
    Name Operator Sample Description
    AND && expession1 && expression2 Both expressions must return true if the outcome shall be true
    OR || expession1 || expression2 One of the expressions must return true if the outcome shall be true
    NOT ! !expression If the expression return false the outcome will be true
  • © 2010 by Finnesand Data. All rights reserved.
    This site aims to provide FREE programming training and technics.
    Finnesand Data as site owner gives no warranty for the correctness in the pages or source codes.
    The risk of using this web-site pages or any program codes from this website is entirely at the individual user.