Add ex2-3.cpp, pattern