Exersize from "Stephen Prata c++ primer plus 6th edition"