updated tutorial code to c++ api