+ 1
The while
for the one where they get peoples input 5 times and puts it into total, does it not just replace the value?? anyone help
6 odpowiedzi
+ 1
Hi Conor, not sure I understand your question. Have you made a code or are you in a course?
+ 1
for c++ the while statement in the last question it tells you to ask the person using the code (me) to enter 5 numbers and add the up but it put it in the same variable and i was wondering would they not just overwrite each other
+ 1
Ok, got you. Yes it does replace the value.
In this instance I believe they are expecting you to do something with the value (eg print) before the next iteration of the loop.
Alternatively you could make the variable an array and store each value as you iterate through the loop.
+ 1
PS welcome to SoloLearn 😁
+ 1
thanks for your help i was just a bit confused at that bit
+ 1
No problem.