开发者社区 问答 正文

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

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

展开
收起
a123456678 2016-03-04 16:26:45 1775 分享 版权
1 条回答
写回答
取消 提交回答
  • 可以这样,先把字符串输出到流中,然后从流中取数据

    #include
    ostringstream command;
    command<<"shutdown -s -t "<<time;
    system(command.str().c_str());
    2019-07-17 18:52:29
    赞同 展开评论
问答分类:
C++
问答标签:
问答地址: