Code:
bool prime(int n)
{
for (int i = 2; i == (n-1); i++)
{
if(n==2)
{
return true;
}
if ((n % i) == 0)
{
return false;
}
}
return true;
}
int main()
{
int count = 0;
bool isitprime;
cout << "The prime numbers from 1 to 10000 are:\n";
for(int loop = 1; loop <= 10000; loop++)
{
isitprime = prime(loop);
if (loop == 2)
{
isitprime = true;
}
else if (isitprime == true)
{
++count;
cout << setw(6) << loop;
if ((count % 10) == 0)
{
cout << "\n";
}
}
}
cout << '\n' << "There were " << count
<< " prime numbers.\n";
return 0;
}
EDIT: **** it. Gotta go home now. Still open for help on this though, because I'll have to email it sometime to the instructor before too long. However, I have work tonight and I must now jet home and try to get a shower and shave in before.




)... I just got hung up on stupid prime number logic bull****. I actually haven't looked at this week's work yet though hahaha

Comment