added pattern.h and main.cpp