patterns by c++