fixed error with an uninitialized variable in main.cpp
fixed memory leak in cp.cpp