You should begin the process of writing this program by constructing an
algorithm for the game itself. I recommend that you initially ignore the
requirements for validating input and for repeating the entire program.
Instead focus simply on playing the game. Once that is working you can
make enhancements. If you aren't sure where to start then follow these
steps:
Construct an algorithm (using pseudocode or a flow chart) for
playing the game.
Start writing the program. Don't type in the
entire game, though. Simply create a program that generates a random
number in the range 1 to 100 and then displays it. Compile and test
your program.
Then add a prompt to have the user make a guess. Put that question
in a loop that will stop only when the user's guess matches the
number. Compile and test the program.
After the loop print a message that congratulates the
user for guessing the right number. Compile and test.
Inside the loop, after the user has entered their
guess, check to see if their guess was too high or too low and give
them feedback appropriately. Compile and test.
Save your program under another name because you now have a
working program that plays the game! All that's left is adding
loops to validate user input and to repeat the actions of the program.
if the user wants to.
Add a loop that will allow the user to play the game again.
Compile and test.
Replace every request for user input with an appropriate loop
that validates that input. Do this one question at a time, compiling
and testing after you complete each.