這個函數在對拍中很常用。
其作用相當于在 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());