Sieve of Eratosthenes defective

Dunning notice to beginners about a trap (I found again, unwittingly).
Not the Sieve of Eratosthenes is incorrect, it's my migration from REXX to C++ here http://www.cplusplus.com/forum/beginner/253520/#msg1114742 (I added a hint there.)
For decades I forgot that assignment to variables implies truncation in some languages. C++ brings back the past of FORTRAN where it is good habit to check if a variable may hold the unaltered result.
Last edited on
Topic archived. No new replies allowed.