Exemple #1
0
// *****************************************************************************
// * Function Name: PrintPrimes                                                *
// * Description:  Asks the user to input a positive inteber.  Keeps asking    *
// *   until a correct value is entered and than returns the value.            *
// *                                                                           *
// * Date: April 1, 2013                                                       *
// * Author: Dr. David A. Gaitros                                              *
// *****************************************************************************
void PrintPrimes(const BitArray & b, const int max)
{   int counter; 
    
    cout << "\nPrimes less than " << max << ':'<< '\n';
     for (int i = 0; i< max; i++)
     {   
       if (b.Query(i))
       {
           counter++;
           cout << i;
         
        if (counter % 8 == 0)
          {
            cout << '\n';
            counter = 0;
          }
          else
            cout << '\t';
       }
     }
}