Solve problem 19 using C++.