+ 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

6th Aug 2018, 11:17 PM
Conor
6 odpowiedzi
+ 1
Hi Conor, not sure I understand your question. Have you made a code or are you in a course?
6th Aug 2018, 11:25 PM
Duncan
Duncan - avatar
+ 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
6th Aug 2018, 11:30 PM
Conor
+ 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.
6th Aug 2018, 11:45 PM
Duncan
Duncan - avatar
+ 1
PS welcome to SoloLearn 😁
6th Aug 2018, 11:46 PM
Duncan
Duncan - avatar
+ 1
thanks for your help i was just a bit confused at that bit
6th Aug 2018, 11:47 PM
Conor
+ 1
No problem.
6th Aug 2018, 11:51 PM
Duncan
Duncan - avatar