c++ exercise sample code.