Solutions for cpp homework.