Convert book.cpp to use C++ I/O