My C++ solutions to the exercise from the book.