Category: Loop Statements

Use of break statement in C++

C++ provides the break statement to implement middle-exiting control logic. The “break statement” is used to exist from the loop (do, for, while) structure and from the switch structure. It causes immediate exit from the body of loop, in switch structure, it is normally used at the end of statements to terminate the processing of […]

C++ Nested Loops (with example programs)

The loop inside the body of another loop is known as nested loop. The loop that contains another loop in its body is called outer loop. The loop used inside the body of outer loop is called inner loop. The nesting can be done up to any level. However, as the level of nesting increases, […]

C++ for Loop (with example programs)

In this article you will know about C++ ‘for’ loop structure, its working, its flowchart, its components and ‘for’ loop programs. Each heading of this tutorial is very important to clear the concept of ‘for’ loop, so completely read this article. What is the ‘for’ Loop in C++ The ‘for’ loop is also known as […]

C++ do while Loop Structure (with example programs)

The do-while loop is also used to execute a statement or set of statements repeatedly as long as the given condition remains true. The ‘do-while’ loop is mostly used for menu selection or to enter records. In menu selection, we have to execute the body of loop at least once.In C++, the general syntax of […]

C++ while Loop Structure (with example programs)

The “while” is a conditional loop structure. It is used to execute a statement or set of statements as long as the given condition remains true. This loop structure is used when the programmer doesn’t know in advance the number of repetitions of loop. The loop is controlled by the user’s given value.The general syntax […]