Solve problem 37 using C++.