modify ch6
correct the code,compiled by g++