0
Someone fix!
The loop isn't working and output isn't random as expected! https://code.sololearn.com/clYoKhEbgjcm/?ref=app
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.
0
Michi so how to fix that?
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