0

I cant understand the FOR LOOP

I can't understand what is FOR Loop. WHAT ARE ITS COMPONENTS? PLEASE EXPLAIN!

16th Apr 2018, 10:23 AM
Bhavik Khatri
Bhavik Khatri - avatar
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.
16th Apr 2018, 10:38 AM
Bartosz Pieszko
Bartosz Pieszko - avatar
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.
16th Apr 2018, 10:29 AM
Bartosz Pieszko
Bartosz Pieszko - avatar
0
and what is the importance of 3rd one ?
16th Apr 2018, 10:35 AM
Bhavik Khatri
Bhavik Khatri - avatar
0
thanks
16th Apr 2018, 10:39 AM
Bhavik Khatri
Bhavik Khatri - avatar