well so far I've quickly cooked up this:
#include
#include
using namespace std;
int main( int argc, char *argv[] )
{
int i = 0, y = 0, x = 0, num = 0, isPrime = 0, primeCount = 0;
int primes[100];
for( i = 0; i <= 100; i++ )
{
isPrime = 0;
for( y = 0; y < sqrt( 100 ); y++)
{
if( i % y == 0)
{
isPrime = 0;
break;
}
else
isPrime = 1;
}
if( isPrime )
{
primes[x] = i;
x++;
primeCount++;
}
}
cout << "\nThere are " << primeCount << " prime numbers" << endl << endl;
for( i = 0; i < primeCount; i++ )
{
cout << primes << " is prime" << endl;
}
return 0;
}
but I get a seg fault for some reason. I'll debug it tomorrow, but you should get the gist of what you should do. Just edit the very first program on page 1 I made to loop over numbers and test them (increase 'num' each time).
[edit]
and you don't need a double, sqrt can only take an int as a paramater, but it returns a double.