adding the cpp code to read data from text