add cpp version of example 4-2
add *.swp to gitignore