Fix cout errors in C code