I\'m working on Project Euler to brush up on my C++ coding skills in preparation for the programming challenge(s) we\'ll be having this next semester (since they don\'t let
C/C++ operates on fundamental data types. You are using a double which has only 64 bits to store a 1000 bit number. double uses 51 bit for the significant digits and 11 bit for the magnitude.
The only solution for you is to either use a library like bignum mentioned elsewhere or to roll out your own.