• Have Any Question?
  • contact@eitworld.com

cpp decision making

C++ decision making statements

    • Decision Making Statement allows user to choose one path from the two or more execution path on the basis of condition or we can say that these statements provide the facility to select one option from the given option on the behalf of some condition. If the condition is true then one set of statement will be executed and if the condition is false another set of statement will be executed.
    • A basic diagram for decision making statement is given below:


  • C++ includes following decision making statements:
Statement Description
if statement An if statement consists of a boolean expression followed by one or more statements.
if…else statement An if statement can be followed by an optional else statement, which executes when the boolean expression is false.
nested if statements You can use one if or else if statement inside another if or else if statement(s).
switch statement A switch statement allows a variable to be tested for equality against a list of values.
nested switch statements You can use one switch statement inside another switch statement(s).

Real Time Web Analytics