DEV Community

Nilufar Isomiddinova
Nilufar Isomiddinova

Posted on

SELECTION STATEMENTS

C++ supports the usual logical conditions from mathematics:

Less than:


a < b

Less than or equal to :


a <= b

Greater than :


a > b

Greater than or equal to :


a == b

C++ has the following conditional statements:

-Use if to specify a block of code to be executed , if a specified condition is true
-Use else to specify a block of code to be executed , if the same condition is false
-Use if else to specify a new condition to test , if the first condition is false.

NOTE THAT' "if" is in lowercase letters . Uppercase letters (If or  IF) will generate an error'
Enter fullscreen mode Exit fullscreen mode
NOTE : 'The code inside { } is the body of the /if/ statement
Enter fullscreen mode Exit fullscreen mode


NOTE : `There can be more than one - else if statement but only one *if* and *else* statements.
Enter fullscreen mode Exit fullscreen mode

Latest comments (0)