0

Someone fix!

The loop isn't working and output isn't random as expected! https://code.sololearn.com/clYoKhEbgjcm/?ref=app

16th Jun 2020, 8:12 AM
Manas Negi
Manas Negi - avatar
3 Respuestas
0
The problem is: you only get one random number in the beginning. Therefore in each loop iteration the computers choice is the same. Instead you should get a new random number in the while loop. Then the choice will change. Same goes for the users choice, it is only asked once. Therefore it will be the same in each round.
16th Jun 2020, 8:23 AM
Michi
Michi - avatar
0
Michi so how to fix that?
16th Jun 2020, 11:00 AM
Manas Negi
Manas Negi - avatar
0
This should do it: Variables need to be initialized in c++ (otherwise they will have a "random" value, whatever was in that memory cell...) Then ask for user input in the loop Changed the do-while condition to 3 points win https://code.sololearn.com/cbnUktnPa3P3/?ref=app
17th Jun 2020, 1:02 PM
Michi
Michi - avatar