It seems do don't fully understand how these sieves work.
You need to store boolean values not numbers.
I think you better start with a simple sieve and use a vector<bool>. In this way you can easily store millions of bools. I know that it is common practice on codechef and similar sites to use these VLA but it's really bad practice to use these illegal constructs.
Try do do this:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
#include<iostream>
#include<vector>
usingnamespace std;
int main()
{
size_t count;
cin >> count;
vector<bool> primes(count, true);
primes[0] = primes[1] = false;
// TO DO - mark all non primes as false
// print all primes here
}