add C++ codes (to be reworked)

some missing, some not finished