added my code to cp.cpp