tasks 2 and 5 coded in cpp
Merge pull request #4 from Lolu28/master

tasks 2 and 5 coded in cpp