Did you check the web pages I sent you the links for?
If so, you'd know that % (the module operator) gives you the remainder for integer division. So testing for 0 == value % 3 is the way to test that value is exactly divisible by 3.
3 % 2 evaluates to 1, as 3/2 = 1 R 1
6 % 2 evaluates to 0, as 6/2 = 3 R 0
Using % allows you to use ints everywhere. Including the loop.
You have to be careful when testing doubles for equality as they are not totally accurate. I can't see the types you are using for Num and Check, but if they're double the the test
Num / Check == 1
might not always work.
As far as the vector goes, the code you posted is incomplete so I can't really comment. But based on your explanation, I suggest you stop pre-sizing the array and use push_back() -- see link I sent before, about vector.
1 2
|
vector<int> PrimNumbers;
PrimNumbers.push_back(2);
|
then use the vector's size() and operator[] -- see same link for more info
Andy
P.S. You are more likely to get a response if your code is clearly and neatly formatted. (Note that you can go back and tidy up code!)