O'Reilly logo

Object Oriented Programming with C++, Second Edition by Sunil Patekar, Mahesh Bhave

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

2.12 ITERATION STATEMENTS

In this part, we will see the statements, which can loop around. This process is termed as iteration. Iteration means the act of repeating a process usually with the aim of approaching a desired goal or target or result. Each repetition of the process is also called “iteration”. The result of iteration is used as the starting point for the next iteration. Such statements will increase the power of computer tremendously. Let us start with very popular statement called “for statement”.

2.12.1 for statement

The for statement is most useful control statement. It allows us to repeat a statement (or a block) for number of times. The general format of for statement is as follows:

for ( expression1; expression2; expression3) ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required