Homework from course C++ for C programmers