Printing 100 prime numbers This is a program I wrote to print out 100 prime numbers. How can I improve it?

// Calculating primes
#include &lt;iostream&gt;
#include &lt;iomanip&gt;
#include &lt;vector&gt;
using namespace std;

int main()
{
    const int MAX(100);      // Number of primes to be identified
    long primes[MAX] = {};
    long trial(5);            // Hold a candidate prime
    int count(0);             // Count primes found
    bool found(false);      // Indicates when a prime is found

    vector &lt;long&gt; nonPrimes; //Vector to hold non prime numbers
    vector &lt;long&gt; disqualify; //Vector to hold prime numbers that disqualify the non prime numbers as prime numbers.

    do
    {
        trial += 2;             // Produce next candidate value
        found = false;      // Reset indicator - assume it is not prime

        for (int i = 0; i &lt; count; i++)   // Try division by existing primes
        {
            found = (trial % primes[i]) == 0; // True if no remainder
            if (found) // No remainder means number is not a prime
                break;
            // Terminate the division loop
        }
        // The above loop will exit either due to a break or after trying all
        // existing primes as a divisor. found was initialized to false. If
        // found is false after exiting the loop, a divisor was not found.
        if (!found)             // We have a new prime: not false = true
            primes[count++] = trial;  // Save candidate in next array position
    } while (count &lt; MAX);

    // Main loop has completed - we have found MAX prime numbers.
    // Display the prime numbers, presenting five numbers on one line.
    cout &lt;&lt; "Prime numbers found during the program execution:" &lt;&lt; endl;
    for (int i = 0; i &lt; MAX; i++)
    {
        if (i % 5 == 0)      // For a new line on first line of output
            cout &lt;&lt; endl;      // and on every fifth line that follows
        cout &lt;&lt; setw(10) &lt;&lt; primes[i];  // Provide space between numbers
    }

    cout &lt;&lt; endl;            // All primes displayed - for a new line

    //system("pause");
return 0;
}
STOP. Do not use system("pause"). This is not portable. If you
haven't already, read
this
Stop using using namespace std. Read
this.
I mentioned this in your last review as well.
You don't need to use std::endl for every new line of your output
table. Doing so flushes the output stream needlessly.
You don't need two vectors. Just two for loops and one vector will
suffice. Take a look at the example below.
For beginner code, I think you have good documentation(comments).
Although for some people, it might err on the side of excessive.
You could have initialized the array with the first three primes.
That would have cut down the number of iterations. 

 long primes[MAX] = {2,3,5};
 int count(0);             // Count primes found



Example:


#include  &lt;iostream&gt;
#include &lt;vector&gt;
#include &lt;iomanip&gt;

using std::cin;
using std::cout;
using std::endl;
using std::setw;


int  main()
{
    int counter = 0;
    std::vector&lt;int&gt; primes;

    int N, output;
    cin &gt;&gt; N;
    output = N;
    for (int i=2; N &gt; 0; ++i)
    {
        bool  isPrime = true;
        for (int j=0; j &lt; primes.size(); ++j)  //First pass(i==2), will not enter second loop because size() == 0
        {
            if (i % primes[j] ==  0)
            {
                isPrime = false;
                break;
            }
        }

        if (isPrime)
        {
            primes.push_back(i);
            --N;
            cout  &lt;&lt;  i  &lt;&lt;  "\n";
        }
    }


    for(int i=0; i &lt; output; i++)
    {
        if (i % 5 == 0)      // For a new line on first line of output
            cout &lt;&lt; "\n";      // and on every fifth line that follows

        cout &lt;&lt; setw(10) &lt;&lt; primes[i];  // Provide space between numbers
    }
    cout &lt;&lt; endl;

    return  0;
}