Train cpp by writing algorithms