Problem 10, C++