c++请问如何取变量的值?

假设i为变量,这样system("shutdown /t %i");取变量的值正确吗

可以这样,先把字符串输出到流中,然后从流中取数据
#include

...
ostringstream command;
command<<"shutdown -s -t "<<time;
system(command.str().c_str());

(如果你的shutdown程序支持i变量)你为什么不这样?

scanf("%d", &i);
system("shutdown /t /i");

cout<< i<<endl;

system("shutdown /t /i");
Lz是这个意思吗