Add Problem 8 c++ solution