add c++ solution for problem 5