exercise of C++