对拍模板

将文件放在一个文件夹,执行test即可
creatrand:

#include<iostream>
#include<ctime>
#include<cstdlib>
using namespace std;
int n,m,k;
int main()
{
    freopen("in.txt","w",stdout);
    srand(time(0));
    n=rand()%60+2;//rand()  0-2^16
    m=rand()%50+3;
    k=rand()%40+1;
    cout<<n<<endl;
    cout<<m<<endl;
    cout<<k<<endl;
}

program1:

#include<iostream>
#include<cstdio>
#include<cstring>
using namespace std;
long long a,b,c;
int main()
{
    freopen("in.txt","r",stdin);
    freopen("1.txt","w",stdout);
    cin>>a>>b>>c;
    if(a>b) swap(a,b);
    if(b>c) swap(b,c);
    if(a>c) swap(a,c);
    cout<<c;
    return 0;
}

program2:

#include <iostream>  
#include <cstdio>  
#include <cstring>  
using namespace std;  
int a,mx,t;
int main()  
{   
    freopen("in.txt","r",stdin);
    freopen("2.txt","w",stdout);
    while(++t<=3)
    {
        scanf("%d",&a);
        if(a>mx)
          mx=a;
        if(mx>50) mx=50;//
    }
    printf("%d",mx);
    return 0;
}

test:

#include<ctime> 
#include<cstdlib>
int main()
{
    int i,j;
    srand(time(0));
    while(1)
    {
        system("CreatRand.exe");
        system("program1.exe");
        system("program2.exe");
        if(system("fc 1.txt 2.txt"))
          while(1); 
    }
}
版权声明:本文为博主原创文章,未经博主允许不得转载。 博主:https://www.cnblogs.com/Menteur-Hxy/
原文地址:https://www.cnblogs.com/Menteur-Hxy/p/9248015.html