Added C++ solution for problem 5.