Decision Making in C++

, ,

C++ conditional statements allow you to make the decision, based upon the result of a condition. These statements are called as 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 a number of 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 Decision-making technique in C++ can be expressed as:

akhtarbari.com

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


Decision Making Statements in C++



0 replies

Leave a Reply

Want to join the discussion?
Feel free to contribute!

Leave a Reply

Your email address will not be published. Required fields are marked *