c and cpp exercise