changed src to cpp to be able to use std namespace
modified code to be c++ compatible