So I'm a beginner to c++ (brand new) and to programming in general. I'm trying to write a basic program that will guess a number I have in mind while keeping track of the attempts made and adjusting it's guesses after each failure. My problem is that I can't figure out how to code it to adjust it's guesses properly. I know my code is extremely sloppy, but any help would be great!
int main()
{
srand(time(0)); // seed random number generator
cout << "\tWelcome to Guess My Number\n\n";
int tries, correct;
do
{
int min = 0; // highest guess that's too low
int max = 100; // lowest guess that was too high
int range = max - min; // Range of its highest low and lowest high
int guess = rand() % range + min + 1; // Random guess
tries = 0;
correct = 0;
cout << guess;