Project Euler Problem #49 in C++