print_primes(myInt);
On this line, you are passing in 1 argument, myInt.
void print_primes(const set<int>& s, int n)
This is the function that you're attempting to call, but it wants
two arguments passed in to it, one that's a set, and one that's an int.
Same issue with sieve.
_________________________
But beyond syntax, think about what your program is currently doing.
You have an array called "prime" (which is illegally allocated as a Variable-Length Array, btw), but you never assign anything to any of prime's elements before checking their values.
If you're going to use an array, then you should have a "bool prime[max_size];" array, initialize all its elements to true, and pass that. And then you need to do the actual sieve logic (see Wikipedia for pseudo-code if you're confused there).
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
|
void generate_sieve(bool is_prime[], int n)
{
is_prime[0] = false;
is_prime[1] = false;
// initially set all numbers to true
for (int i = 2; i < n; i++)
{
is_prime[i] = true;
}
// ... sieve logic ...
// ... is_prime[i] = false; ...
}
// ...
const int MaxSize = 2000;
bool is_prime[MaxSize];
generate_sieve(is_prime, MaxSize);
|
PS: This is a skill that comes with practice, but it is important to give meaningful names to variables. "myInt" is not a meaningful name, because it doesn't describe the purpose of the variable.