C++ code to find largest prime factor