C++写对拍问题,玄$\color{white}0$关
  • 板块学术版
  • 楼主I_Love_DS
  • 当前回复3
  • 已保存回复3
  • 发布时间2024/9/15 21:11
  • 上次更新2024/9/16 07:09:24
查看原帖
C++写对拍问题,玄$\color{white}0$关
1118614
I_Love_DS楼主2024/9/15 21:11

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;
}
2024/9/15 21:11
加载中...