I have to write a program that will run a random guessing game. The game is to be numbers from 1-100, the guesser gets 20 tries and at the end is supposed to be asked if they wo
One problem that I see is that you are picking a new random number for each user guess. This is wrong.
To fix this you should put the
number=rand()%100+1;
line before the do while loop that loops asking for guesses.
A second problem is the condition on that loop is not correct. You should loop until number == guess not number > guess and put the both couts that tell the user if the guess is high or low inside the loop and increment your tries inside the loop as well.
Also you probably want to have an outer do while() loop for the question that asks you to play again instead of this loop being after the loop that waits till the user gets the right number.