0
Loops C++
In a for loop, how do you add the number of the same variable for each loop?
5 Respuestas
+ 3
I don't know what you mean, can you show a simple example?
+ 3
Here I corrected the errors. You forgot to write variables declarations and you got some syntax misstakes too. I added variable 'sum' which counts sum of the missed days.
https://code.sololearn.com/cXU6FondIKAd/?ref=app
+ 1
https://code.sololearn.com/cmG7LIvOx5VD/?ref=app
+ 1
https://code.sololearn.com/c6TOtfFvl03A/?ref=app
You have to set sum equal to zero in main. If it was declared outside of main, you wouldn't have to, but you should anyways Aleksander Szczepura
0
So every time the loop happens and I enter a value for “missedDays” I want to add the values of each “missedDays” together.