Added C++ solution to problem 4.