Posted by: Dananah October 17, 2004
Login in to Rate this Post:
0
?
![](/wysiwyg/editor/images/smiley/msn/thumbs_up.gif)
![10 more flags than likes deactivates post.](/wysiwyg/editor/images/smiley/msn/thumbs_down.gif)
hey Robert...im not good in explaining so im asking me fren to explain...hope it helps..did a smiliar program in Java..but already deleted it..so guess cant pass it to u to help..anyways hope what me fren says...helps..he is a self acclaimed programming god ;o) well he is good..but not that great...shhhhhhh ;o)...
I dont really understand what the problem is. It would be more helpful if you posted the actual assignnment specifications. Anyways i'm assuming what you have to do is make a program such that the program asks the user to think of a number between a particular limit(eg. 1 to 100) and then tries to guess the number in a certain number of attempts
The best way to do this is using binary search method. I havent done C in a long time so i dont really remember the syntax but i can write the pseudocode for you
{
guess the middle number of the limit(eg. 1-100). lets call it G
ask the user if the number he/she thought of is less than, equal to or greater than G
if its equal then the computer's guess is correct and program terminates saying so.
If its less than G, then change the limit to lower limit(eg. 1) up to G-1
If its more than G, then change the limit to G+1 upto upper limit(eg. 100)
}
repeat this loop
have fun programming..its fun aint it?well it is when u can make it work hehe..
danny