Question d’entretien chez Capgemini

Solve this pseudo code for the c++ code?