cpp code to calculate lottery set