rt,生成数据、标准程序、我的程序,需不需要加 freopen
对拍程序如下
#include <cstdlib>
#include <iostream>
// 别问了,是AI写的
int main() {
// 构建比较文件的命令
system("gen.exe > 1.txt");
system("biaozhun.exe < 1.txt > 2.txt");
system("wodechengxu.exe < 1.txt > 3.txt");
const char* command = "fc 2.txt 3.txt > result.txt";
// 执行命令
int result = system(command);
// 检查命令执行结果
if (result == 0) {
std::cout << "Files are the same." << std::endl;
} else {
std::cout << "Files are different." << std::endl;
}
return 0;
}