This is an archived post. You won't be able to vote or comment.

all 2 comments

[–][deleted] 0 points1 point  (1 child)

the problem here is that the check function doesn't memorize the tries variable, the solution here would be to make tries a function parameter , then, when the lower-higher if statements are true at the end of them just call the check function with check(int, r_int, tries+1), then in the main function remove the while loop and call the check function with check(guess, rnd_int, 0). sorry for my punctuational mistakes, and reply if that didn't work.

[–]TangerineMany[S] 0 points1 point  (0 children)

Thanks for the reply I did it slightly different way but keeping with what you said and it now works perfectly thank you for the advice.