Brand new to c++, problems with guessing game

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!

#include <iostream>
#include <limits>
#include <cstdlib>
#include <ctime>

using namespace std;

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;

cout << "\n";
++tries;
cin >> correct;
cout << "\n\n";

if (correct = 1)
++min;

if (correct = 2)
--max;
} while (correct != 3);

cout << "I guessed your number in" << tries << "tries!";

return 0;
}
If the hidden number is greater than guess, min = guess.
If the hidden number is lower than guess, max = guess.

Variable tries is set to 0 on every cycle, so it will never be more than 1.
Use code tags when posting code.
You can solve with bool and while.
Please use [CODE] tags.
Topic archived. No new replies allowed.