Reverse "Guess the Number" program
Sure this generates a random number from 1 -> 100.

int compNumber = rand() % 100 + 1;


BUT not all the numbers have an even probability. Assuming RAND_MAX is 32768 (a common value). Then the number 1->68 have a slightly higher probability than the number 69->100.

To get an even distribution you need to compensate for this:

int compNumber
do
{
    compNumber = rand();
}
while (compNumber &gt; (RAND_MAX / 100 * 100));
compNumber = compNumber % 100 + 1;


Better yet learn to use the modern random number generator that is built into C++.

// I have not tested this.
// Just copied and pasted from: http://stackoverflow.com/a/19666713/14065
// This is the modern equivalent of srand()
std::random_device rd;
std::mt19937 mt(rd());
std::uniform_real_distribution&lt;int&gt; dist(1, 100);


// Then usage is.
// equivalent of rand().
std::cout &lt;&lt; dist(mt) &lt;&lt; "\n";


This does not look correct:

    if      (compNumber &gt; yourNumber)
    {}
    else if (compNumber &gt; yourNumber)
    {}


The conditions look the same to me.

This does not look like guessing.

        do
        {
            --compNumber;
        } while (compNumber != yourNumber);


This looks like the computer counting down until it reaches your number.