completed prob85.cpp