C++ Decision Making

C++ conditional statements allow you to make a decision, based upon the result of a condition. These statements are called Decision Making Statements or Conditional Statements.

So far, we have seen that all set of statements in a C++ program gets executed sequentially in the order in which they are written and appear. This occurs when there is no jump based statements or repetitions of certain calculations. But some situations may arise where we may have to change the order of execution of statements depending on some specific conditions. This 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 zero or null, treated as false.

This type of structure requires that the programmers indicate several conditions for evaluation within a program. The statement(s) will get executed only if the condition becomes true and optionally, 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:

Decision Making Flowchart

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

Decision Making Statements in C++

Scroll Back to Top