C++ Loops :

What is loops in C++ Language ?

Sometimes we want a C++ program to repeat something over and over again, a loops is used to make a program do something more than one time thats called loops. C++ supports following types of loops:

C Language loop Comparison - All loops constructs C++ repeat a set of condition remains true. This specified condition is generally referred to as a loop control. For all three loop statement, a true condition is any nonzero value. A zero value indicates a false condition.

Loop Control Elements :

Every loop has its elements that control and govern its execution. Generally, a loop has four elements that have different purpose. These elements are as given below :

  • Initialize Expression : Before entering in a loop, its control variables must be initialized. The initialization expressions is executed only once, in the beginning of the loop.

  • Test Expression : The test expression is an expression whose truth value decides whether the loop-body will be executed or not. If the test expression evaluates to true(1) the loop-body gets executed, otherwise the loop is terminated.

  • Update Expression : The update expressions change the values of loop variables. The update expressions is executed at the end of loop (;) after the loop-body executed.

  • The Body-of-the Loop : The statement that are executed repeatedly (as long as the test-expression is nonzero) from the body of the loop.

Next Update

Loading...

We adding new programming language tutorials very soon.

We make a Collaboration with HackIsOn YouTube Channel So, Please Subscribe Their Channel and keep supporting