Duh... I have an example of what i'm looking for. This is one that I did in class but i need to change it so that the computer picks the number and the user guesses (oh an Esp. that program didn't work x.x I think it's cuz our compiler is Microsoft Visual C++ 4.0) Anyways... here's the program we did
*Note I need to change it so the computer picks the number*
#include <iostream.h>
void main ()
{
char high_low;
int done = 0, current_guess = 50, highest = 100, lowest = 0;
do{
cout<<"Is "<<current_guess
<<"too high, too low, or is it right? ('h', 'l', 'r')";
cin>>(high_low)
switch (high_low)
{
case 'l':
if (current_guess > lowest);
{
lowest = current_guess;
}
current_guess = current_guess + (highest - current guess) /2;
break;
case 'h':
if (current_guess <highest);
{
highest = current_guess;
}
current_guess = lowest + (current_guess - lowest) /2;
break;
default:
cout<<high_low<<" is not a valid choice \n";
break;
}
}while (!done);
}
Umm... yeah that's about it...but I need it done so that the computer 'thinks' of the number and the person guesses.... anyone that can help me with this?
