added function.cpp for programming lab 5