modify beginend c++ snipet