c++ version for Q1 added