I have this all done but it does not seem to work.
What specifically does that mean? There are an infinite number of ways to screw up cod, and I don't have time to wonder. Does it go into an infinite loop? Does it do nothing? Does it print out 'kiss off'? What are you expecting to happen, and at what point is it not doing what you expect it should? Have you tried dumping the contents of whatever variables you may be using to the console to see is they contain what you think they contain? Are you dumping your variables to the console right before any 'if' statements to see that you have the values that you think you have?
cout is your friend.
EDIT: There is a much better way to do that. If your number is between one and 50, then the very first guess should be half of that....25. So if I were you, I would have a variable holding the max, which is 50. I would have a variable called min, which at the beginnig would be zero. If the number was greater than 25, then the new min would be 25, and the max would remain at 50. If the number was below 25, then the new max would be 25. Then I would have the application guess the number that was halfway between the max and the min, and so on, until the numbe was guessed. That way, you can use a function, pass it the min and max, and return whatever number is halfway between.