码迷,mamicode.com
首页 > 其他好文 > 详细

关于对拍

时间:2018-12-11 01:30:32      阅读:191      评论:0      收藏:0      [点我收藏+]

标签:sleep   sys   生成   srand   main   time   close   关于   using   

先生成随机数
```cpp
#include
#include
#include
#include
using namespace std;
long long seed;
int main()
{
	freopen("merge.in","w",stdout);
	seed=time(0);
	srand(seed);
	int n=20;//32768
	cout<<n<<endl;
	for(int i=1;i<=n;i++)
		cout<<rand()<<‘ ‘;
	fclose(stdout);
	return 0;
}
```
然后调用
```cpp
#include
#include
#include
using namespace std;
int main()
{
    int cnt=0;
    while(cnt<=100)
    {
        cnt++;
        system("start sjmaker.exe");
        Sleep(100);//防止未完成计算就执行,根据需要适当提高
        system("start baoli.exe");
        Sleep(200);
        system("start zhengjie.exe");
        Sleep(200);
        if(system("fc baoli.out zhengjie.out"))
        {
            system("pause");
            break;
        }
    }
}
```

关于对拍

标签:sleep   sys   生成   srand   main   time   close   关于   using   

原文地址:https://www.cnblogs.com/member-re/p/10100061.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!