Solve problem 32 using C++.