did some of ex 8 in cpp