working cp.cpp without timer