added snippets code to asst4.cpp