problems looping for my first time.

I'm creating a program that generates a random number from 1-100, then it asks the person to guess the number. If the number is too low it will tell them its too low and try again. if its too high the program will tell them its too high and tells them to try again, until they guess they right number.

The problem is that my program randomly ends without the correct answer being finalized. Sometimes it does finish, but sometimes it doesn't. I don't know why its doing that, please help!!! Thanks ahead of time!
Here's my code:

Also for copying code into forums they usually have a code format "[ code] and [ /code]" (Delete the spaces) that make the code much easier to read. Just a tip for future posts. Otherwise looks great keep it up man.

Thank you chervil! I GOT IT! lots of help man! thank you for taking the time to explain it! when all hope was lost you showed me light! :)

It works fine however it only gives me the number 42 for my random number, and continues to give me 42 each time i run it. I was intending to make it give me a different number each time i ran the program. Help please!

side note: i'm trying to use the correct format, but i'm failing :( do i type /code then paste code?

About the random number. Change this line: int srand(time(NULL)); //seeds the generator
to this: srand(time(NULL)); //seeds the generator
The first version is just a declaration, it tells the compiler the name of the function, and that it returns an integer. The seccond (corrected) version actually calls the function.

Regarding your code, it's fine no problems, well done.
But while we're here, sometimes it's worth looking if code can be shortened.
Start with this, which is ok: