windows xp下的c++对拍程序

对拍程序:

#include<iostream>
#include<cstdio>
#include<cstring>
#include<windows.h>
using namespace std;
int main()
{
    while(1)
    {
        system("data > data.in");//运行data程序生成数据,在data.in中输出
        system("right < data.in > right.out");//运行程序1,在data.in中读入,在right.out中输出
        system("wrong < data.in > wrong.out");//运行程序2,在data.in中读入,在wrong.out中输出
        if(system("fc right.out wrong.out"))break;//比较right.out和wrong.out,如果出现不同,则break。
    }
    system("pause");
    return 0;
} 

生成数据:

#include<iostream>
#include<ctime>
using namespace std;
int main()
{
    srand(time(0));//保证每次生成的数据不同 
    "生成数据部分" 
    return 0;
}
原文地址:https://www.cnblogs.com/cax1165/p/6070879.html