0
I cant understand the FOR LOOP
I can't understand what is FOR Loop. WHAT ARE ITS COMPONENTS? PLEASE EXPLAIN!
4 Réponses
0
For example:
for(int i = 1; i <= 5; i++)
cout << i << endl;
gives us:
1
2
3
4
5
for (int = 1; i <=5;)
cout << i << endl;
1
1
1
1
1
1
1
1
...
The loop is infinite.
0
for (int i = 1; i <= 5; i++)
The first is initializer of counter.
The second is statement. The loop will continue do until it is true.
The third is changing counter. It is running after each loop.
0
and what is the importance of 3rd one ?
0
thanks