Old homework from c++ course