对拍程序

代码1

#include<iostream>
using namespace std;
int main()
{
    int a,b;
    cin>>a>>b;
    cout<<a+b<<endl;
//    system("pause");
    return 0;
}

代码2

#include<iostream>
using namespace std;
int main()
{
    int a,b;
    cin>>a>>b;
    while(b--) a++;
    cout<<a<<endl;
//    system("pause");
    return 0;
}

datamaker

#include<iostream>
#include<ctime>
#include<cstdlib>
using namespace std;
int main()
{
srand(time(0));
int a,b;
a=rand();
b=rand();
cout<<a<<' '<<b<<endl;
//system("pause");
return 0;
}

对拍

#include<iostream>
#include<windows.h>
using namespace std;
int main()
{
    int t=100;
    while(t--)
    {
        system("data > a+b.in");
        system("zj < a+b.in > 1.out");
        system("duipai < a+b.in > 2.out");
        if(system("fc 1.out 2.out"))   break;
    }
    system("pause");
    return 0;
}

把exe文件放在一个文件夹内,然后运行对拍文件

posted @ 2015-04-20 20:24  qscqesze  阅读(859)  评论(1编辑  收藏  举报