C++homework