# Help with prime numbers program code

edited October 2013
I am new to C++ and had to use a template for this project. I cannot get it to work. Please help with corrections if possible.

#include
#include
#include
#include

// Function prototype

// main
void main()
{
int count =0;
cout << "The prime numbers from 1 to 1000 are:
"<<endl;

for ( int x = 2; x <= 1000; x++)
count++;
cout << setw ( 6 ) << x;
if (count % 10 == 0)
cout << '
';

}
cout << '
' << "There were " << count
<< " prime numbers
";
return ;
}

// function definition

{

for(int i=2; i<=num; ++i)
if(num % i ==0) return false;

return true;

}

• #include

#include

// Function prototype

// main
void main()
{
int count =0;
cout << "The prime numbers from 1 to 1000 are:
"<<endl;

for ( int x = 1; x <= 40; x++) //just change this back to a 1000
{
count++;
cout << x << endl;
if (count % 10 == 0)
cout << '
';

}
cout << '
' << "There were " << count
<< " prime numbers
";
return ;
}

// function definition

{

for(int i=2; i <=3; i++)
if(num % i ==0)
return false;

return true;

}