LOOPS IN C++
The meaning of loop is a round structure which has no end point.
In C++ loops exactly operates like that the main difference is they stop when you tell them to stop.
Loops can execute a piece of code until it reaches a certain condition telling it to stop.
Loop are essential in coding because they can save much time and reduce lines of code and can also reduce the chances of error in the code.
There are 3 types of Loop:
- While (loop)
- For (loop)
- Do – While (loop)
In while loop we put a condition to stop the certain loop.
The loops execute the piece of code written in it until the given condition becomes FALSE.
For Detail (while) loop Article click this link: https://proteacharticles.com/2019/12/21/while-loop-in-c/
In for loop we initialize the counter of the loop within its syntax along with the condition and the increment or decrement statement.
It works same as the other loop the only difference is the syntax but it is essential to use for loop instead of while loop.
For Detail (for) loop Article click this link: https://proteacharticles.com/2019/12/21/for-loop-in-c/
do – while Loop:
This loop is a next level of while loop it is defined as that it executes the code first than checks the condition. The code written within this loop will always execute at least one time before checking the condition.
For Detail (do – while) loop Article click this link: https://proteacharticles.com/2019/12/21/do-while-loop-in-c/