- 1

I don't understand this how it runs .

14th Sep 2017, 9:34 AM
Su'aad Shwbar
Su'aad Shwbar - avatar
6 Réponses
+ 2
int age = 0; while( age <= 10 ) { cout << age << endl; age++; } this while loop will print numbers from 0 to 10. Every time it loops, it increments age by 1. So when age will be at 10, it will be incremented to 11. Then while loop condition will be false because 11 > 10. So it will stop looping
14th Sep 2017, 10:49 AM
Eligijus Silkartas
Eligijus Silkartas - avatar
+ 9
which and where? can you provide an example?
14th Sep 2017, 9:53 AM
jay
jay - avatar
+ 1
while loop increment
14th Sep 2017, 10:35 AM
Su'aad Shwbar
Su'aad Shwbar - avatar
0
I don't understand this int num =1 ; int number ; int total=0; while (num<=5){ cin >> number ; total+ = number ; num++; } cout <<total << endl;
14th Sep 2017, 4:26 PM
Su'aad Shwbar
Su'aad Shwbar - avatar
0
if I enter 1 why does it execute 5
14th Sep 2017, 4:27 PM
Su'aad Shwbar
Su'aad Shwbar - avatar