Answers to C++ exercises