stringstream ss;
ss << "shutdown -s -t " << n;
system( ss.str().c_str() ); // str() returns a std::string with the contents of the stream, c_str() the equivalent C string
Just making a small c++ project (just started with c++) called shutdown manager :)
I think system() is good because you can use cmd commands with it. Like system("cls"); to clear the screen.