Pregunta de entrevista de think-cell

Write a function in C++ that implements a given functionality.