BACH implemented with c++