Online visitors

People learning around the world

Online

—

Visitors exploring W3Schools

Online visitors by country Circles show approximate country locations. The country list provides the visitor counts.

Circles represent countries, not exact visitor locations.

Country

Online

Loading country activity…

    C++ Decision Making

    C++ conditional statements allow you to make decisions based on the result of a condition. These statements are called Decision Making Statements or Conditional Statements. This tutorial will briefly teach you about the various Decision Making statements in C++.

    So far, we have seen that in a C++ program, all the statements are executed sequentially in the order in which they are written and appeared. This occurs when there is no jump-based statement or repetition of specific calculations. But some situations may arise where you may have to change the order of statements' execution depending on particular conditions. It involves a kind of decision making from a set of calculations. It is to be noted that C++ assumes any non-zero or non-null value as true and if 0 (zero) or null treated as false.

    This type of structure requires that the programmers indicate several conditions for evaluation within a program. The statements will get executed only if the condition becomes true and optionally, an alternative statement or set of statements will get executed if the condition becomes false.

    The flowchart of the Decision-making technique in C++ can be expressed as follows:

    Decision Making Flowchart

    C++ languages have such decision-making capabilities within their program by the use of following the decision making statements:

    Decision Making Statements in C++

    These above decision-making statements are described in more detail in subsequent tutorials.



    Found This Page Useful? Share It!
    Get the Latest Tutorials and Updates
    Join us on Telegram

    Notifications

    Updates are enabled for this browser.

    Receive new tutorials, articles and learning resources. You can turn updates off anytime.