homework on c++ class