C++ homework