Viewing 1 to 4 of 4 items
Tag Archives: control flow

C++ Do While Loop

The Do While Loop is different from the While Loop for one reason only. The condition is checked after executing the statements. Therefore, this loop guarantees that the statements will be executed at least once. The syntax for the Do While Loop is below: do {   // Statements …   } while ( condition  Full Article…

3

C++ If Else Statements

In our previous tutorial, we learned about C++ input and output to make our programs more interactive. Well, today we are going to learn how to use If Then Else statements to allow us to control the flow of the program. This will allow us to execute code based on a given condition. Below is  Full Article…

0

Advanced Control Flow – Switch Statements

A switch statement allows you to control the flow of your program similar to if and else statements, but can be easier for the user to understand. The Switch Statement The structure of a switch statement is the following: switch(expression) { case : statements break; case : statements break; //More cases… default : statements }

5

Basic Control Flow

In the following tutorial, you’ll learn how to use if, and if-else statements. They are useful for deciding on what lines of code to execute based on values of previous variables in your program. The If Statement An example is as follows int x; if ( condition ) x = 50; //If condition returns TRUE,  Full Article…

0