Modified program10.cpp for part 2 of the homework assignment.