jonsca
Quantitative Phrenologist
5,621 posts since Sep 2009
Reputation Points: 1,165
Solved Threads: 581
Your primality tester is flawed, for example 49 according to this primitive test is prime (but for every number <49 it is correct). Also it will not finish if k>0, because only manipulation you do with k is incrementation in line 24, and in the following line you test it if it is less then 2.
PS. Good indention for Prime::count:
void Prime::count(int k,int l)
{
int f=k%2;
int g=k%3;
int h=k%5;
do
{
if (f==0)
break;
else if (g==0)
break;
else if (h==0)
cout << k;
k++;
} while (k<=l);
}
Zjarek
Junior Poster in Training
79 posts since Oct 2009
Reputation Points: 20
Solved Threads: 18