Cascade Model in C++