added c++ codes