exercises in c++ from text book