added cpp code