merging c++ code