tasks 2 and 5 coded in cpp