add c++ part for ex3.3.1