added cpp simulator main code