How to fix erros in the cpp?