corrected c++ exercise 6, completed prolog practice