数据生成c++程序模板

这是一门技术活,ε=(´ο`*)))唉

 1 #include<iostream>
 2 #include<cstring>
 3 #include<cstdio>
 4 #include<string>
 5 #include<queue>
 6 #include<vector>
 7 #include<algorithm>
 8 #include<ctime>
 9 #include<cmath>
10 #include<fstream>
11 #define R register
12 #define ll long long
13 using namespace std;
14 ll n,m;
15 char wbing[10000];
16 void makedata1(int i)
17 {
18     sprintf(wbing,"poi%d.in",i);//"poi"文件名 
19     freopen(wbing,"w",stdout);
20 }
21 void makedata2(int i)
22 {
23     fclose(stdout);
24     sprintf(wbing,"std.exe < wood%d.in > poi%d.out",i,i); 
25     system(wbing);
26 }
27 int main()
28 {
29     srand(time(0));//初始化时间种子 
30     for(int nw=1;nw<=10;nw++)//要生成的第几组数据
31     {
32         makedata1(nw);
33        /*    if(nw<=5)
34         {
35             n=rand()*rand()%100;
36             for(int j=1;j<=100000000;++j);
37              m=rand()*rand()%25;
38         }
39         else 
40         {
41             n=rand()*rand()%1000;
42             if(n<=100)n+=100;
43             for(int j=1;j<=100000000;++j);
44             m=rand()*rand()%50;
45             if(m<=25)m+=25;
46         }
47         cout<<m<<" "<<n<<endl;*/ 
48         //你想生成怎样的数据 
49         makedata2(nw);
50     }
51     return 0;
52 }

 

posted @ 2018-03-01 19:03  月亮茶  阅读(803)  评论(6编辑  收藏  举报