Refactored Euler cpp 1-9