Added C++ source for Problem 2