I'm learning C++ right now and one of the activity/tutorial things was to re-write the High/Low Guess My Number game - with a twist. I had to re-write it so that the computer had to guess the number.Here's the exercise prompt:Write a new version of the Guess My Number program in which the player and computer switch roles. That is, the player picks a number and the computer must guess what it isAnd, here's what I wrote:// Guess My Number - Computer vs Player#include <iostream>#include <cstdlib>#include <ctime>using namespace std;int main(){    srand(static_cast<unsigned int>(time(0)));    int tries = 0;    // short stuff; // Waiting for solution    bool error = false;    enum statusTypes {NADA, HIGH, LOW, CORRECT};    int status = NADA;    int min = 0;    int max = 101;    int guess = rand() % 100 + 1;    //int previousGuess; // Only for duplicate guess checking    // ^ Not used currently, 1.1 release will fix duplicate PC guesses    int toGuess;    cout << 01010111 01100101 01101100 01100011 01101111 01101101 01100101 00100001\n;    cout << Welcome to Guess My Number\n;    cout << Computer vs Player Edition\n\n;    cout << Please enter your number (between 1 & 100): ;    cin >> toGuess;    cin.get();    while (status != CORRECT)    {        ++tries;        cout << Computer's Guess:  << guess << \n;        //previousGuess = guess; // Part of Duplicate PC guesses (1.1)        cout << Press ENTER to continue... << endl;        cin.get();        /*cout << \n1st Debug Statements:\n << endl;        cout << Here's the current values: \n;        cout << Status:  << status << endl;        cout << toGuess:  << toGuess << endl;        cout << guess:  << guess << endl;        cout << tries:  << tries << endl;        // ^ Debugging Statements*/        if (guess < toGuess)        {            status = LOW;            //cout << \nStatus:  << status << \n; // Debugging        }        else if (guess > toGuess)        {            status = HIGH;            //cout << \nStatus:  << status << \n; // Debugging        }        else if (guess == toGuess)        {            status = CORRECT;            //cout << \nStatus:  << status << \n; // Debugging        }        else        {            error = true;            cout << Uh, something went wrong.\n;            cout << Here's the current values: \n;            cout << Status:  << status << endl;            cout << toGuess:  << toGuess << endl;            cout << guess:  << guess << endl;            cout << tries:  << tries << endl;        }        /*cout << \n2nd Debug Statements\n << endl;         cout << Here's the current values: \n;        cout << Status:  << status << endl;        cout << toGuess:  << toGuess << endl;        cout << guess:  << guess << endl;        cout << tries:  << tries << endl;        // ^ Debugging Statements*/        if (status == HIGH)        {            max = guess;            //cout << \nReached status == HIGH << endl; // Debugging            do            {                guess = rand() % 100 + 1;            } while (guess > max || guess < min);        }        else if (status == LOW)        {            min = guess;            //cout << \nReached status == LOW << endl; // Debugging            do            {                guess = rand() % 100 + 1;            } while (guess > max || guess < min);        }        else if (status == CORRECT)        {            cout << Computer Guessed It!\n;            cout << The guess was  << guess << \n;            cout << And it took  << tries <<  tries!\n;            cout << Thanks for playing! << endl;        }        else        {            error = true;            cout << Uh, something went wrong.\n;            cout << Here's the current values: \n;            cout << Status:  << status << endl;            cout << toGuess:  << toGuess << endl;            cout << guess:  << guess << endl;            cout << tries:  << tries << endl;        }        /*cout << \n3rd Debug Statements:\n << endl;         cout << Here's the current values: \n;        cout << Status:  << status << endl;        cout << toGuess:  << toGuess << endl;        cout << guess:  << guess << endl;        cout << tries:  << tries << endl;        // ^ Debugging Statements   */    }    return 0;}Obviously, this isn't the most crucial of projects. I was just curious how my coding skills are!
Guess My Number - computer guesses the user's number
c++;beginner;game;number guessing game
First of all, I'd like to commend you for calling srand() in main() only.  It's quite common for many to call it elsewhere instead, which messes up the randomization.Overall, this looks pretty clean for a beginner.  Indentation and whitespace is consistent and the code flows okay.  Nonetheless, there are still some points to address, and I'll just provide some basics.Once you learn about creating functions, I highly recommend you incorporating this program and future ones.  Having everything in main() makes code harder to read and maintain, but it's not as severe with this short program.  I'd consider that your next step in your learning.For instance, you can have a function for all the conditional statements with status.  This will remove duplication, thus shortening your code and having that functionality in one place.Here's what one conditional may look like with such a function call:if (status == HIGH){    max = guess;    guess = randNumber(guess, min, max);}You'll just need to define this function that will assign to guess.Try not to have so much commented-out code, at least on your Code Review submission.  It makes it harder to read and review, though I understand that it's for debugging.  That's not important for others, so you can leave out this information at that time.I assume NADA refers to an unassigned status type.  In either case, you can rename it to sound more relevant to its use.As for the enum itself, you can just name it Status.  It's a type, so it can be capitalized.