Show HN: Data Structures and Algorithms(github.com) |
Show HN: Data Structures and Algorithms(github.com) |
For example, for the Eratosthenes sieve, your main is:
int main()
{
sieveOptimized(100);
for(int j=0;j<100;j++)
if(isPrime[j])
cout <<j <<"\n";
}
I am suggesting to change it into: int main(int argc, char* args[])
{
int n = atoi(args[1]);
sieveOptimized(n);
for(int j=0;j<n;j++)
if(isPrime[j])
cout <<j <<"\n";
}