Update exercise3.31.cpp