Ciao,

prova a sostituire
cout << "Content-Type: text/plain";

con
cout << "Content-Type: text/html\n\n";