C++ Course Collatz assignment