IBM Interview Question

Coding question in C++ and one SQL query