0
/*我想这样做,但它是无效的。 所以任何帮助将不胜感激。 */如何在系统中使用字符串变量(“say string variable”)?
#include <cstdlib>
#include <iostream>
#include <string>
using namespace std;
int main()
{
string name = "Karma";
string greet = "How was your day?";
string sums = name + greet;
system("say %s", sums) // not working
// system("say sums") not working
return 0;
}
'系统(( “说” +资金).c_str());' – HolyBlackCat
也“[为什么“使用命名空间标准”被认为是不好的做法?](https://stackoverflow.com/questions/1452721/why-is-using-namespace-std-considered-bad-practice)“。 – HolyBlackCat
'system'接受一个指向常量字符串而不是'class string'的指针。 – Raindrop7