+ 2

Explain

Hey guys, I don't understand this code, what that means literally: while (num <= 5) { cin >> number; total += number; num++; help please

11th Oct 2016, 12:43 PM
Alal Gnaba
Alal Gnaba - avatar
2 Respuestas
+ 2
until "num" is minor or equal to 5, it ask you a "number", add it to "total", and increment "num".
11th Oct 2016, 1:36 PM
marcram
+ 2
its saying that while num is less than or equal to 5, it will keep repeating. so if num starts at 0, then the num++ will keep ading 1 to num. num++ means num + 1... so the loop keeps changing num until it gets to 5 then it will stop when 5 turns to 6 because then num <= 5 will be false and stop the loop....
16th Oct 2016, 12:50 AM
Jose Moreno
Jose Moreno - avatar