Hey! I've been trying to get the answer to Project Euler problem 10 and am having some troubles :o
I'm using the standard Sieve of Eratosthenes approach to the problem. My problem is that every time i try to make my sieve have 2000000 slots the program crashes! Everything works perfectly if I'm just getting for example the sum of the primes below 10. Please help me, thanks!
You should use a vector instead of a raw array (or use new to create your class instance). In particular, you should use a vector<bool>, which cuts down memory usage to 1/32 of what it is now.