Hi,
I am not sure what is wrong with this code and how to fix it.
It should stop when comp or user reaches 10 wins.
Besides MAXNUMgames I am not sure what else is wrong.
MAXNUMGames is supposed to be the maximum number of games, and should end when one of the participants (user or computer) is the first reaching 10 wins.
variable names!
if I see maxgames, I expect to play 10 rounds.
if I see matchwincondition or words to that effect, I know that it takes that many won rounds to stop.
that is if I see maxgames is 10, I play 10 games, win 3, lose 3, draw 4, total 10 games.
if i see matchwincondition is 10, I could play 50 games, win 10, lose 9, and draw 31.
MAXNUMGames is not helping you as a boolean expression.
you just need
do
{
play_games();
} while(userscore <10 && compscore < 10); //as soon as either is 10, this is false.
or
const int MAXNUMGames = 10;
while(userscore <MAXNUMGames && compscore < MAXNUMGames ); //better to use a named constant, so this is the way to go (apart from the name of it, which I would still adjust)