C++ HW2 fixed