这个函数在对拍中很常用。
其作用相当于在 cmd 中写东西。
但如果你要批量跑程序,这时编译器会报错,如下面的程序会 CE:
string file_name="test";
system(file_name+".exe");
这时需要将 c++ 的
string
类型转成 c 的。
举个例子:
string file_name="test";
string command=file_name+".exe";
system(command.c_str());