标签:
1 #include <cstdio> 2 #include <iostream> 3 #include <cstdlib> 4 #include <time.h> 5 #include <cstring> 6 #include <windows.h> 7 using namespace std; 8 9 char in[15] = "std00.in"; 10 char out[15] = "std00.out"; 11 const int L_file = 1; 12 const int R_file = 2; 13 14 void _init() //每次循环的数值清空 15 { 16 //此处清零 17 18 return ; 19 } 20 21 void _in() 22 { 23 in[8] = ‘\0‘; 24 out[9] = ‘\0‘; 25 for(int __i = L_file; __i <= R_file; __i ++) 26 { 27 in[3] = __i / 10 + ‘0‘, in[4] = __i % 10 + ‘0‘; 28 if(freopen(in, "w", stdout) == NULL) system("in失败"); 29 30 //此处开始打印测试数据 31 32 system("已处理完一项输入数据"); 33 } 34 return ; 35 } 36 37 void _out() 38 { 39 int n, m; 40 for(int __i = L_file; __i <= R_file; __i ++) 41 { 42 _init(); 43 in[3] = __i / 10 + ‘0‘, in[4] = __i % 10 + ‘0‘; 44 if(freopen(in, "r", stdin) == NULL) system("in2失败"); 45 46 out[3] = __i / 10 + ‘0‘, out[4] = __i % 10 + ‘0‘; 47 if(freopen(out, "w", stdout) == NULL) system("out失败"); 48 49 //此处放代码 50 51 system("已处理完一项输出数据"); 52 } 53 return ; 54 } 55 56 int main() 57 { 58 srand((unsigned)time(0)); 59 60 _in(); 61 _out(); 62 63 fclose(stdin); 64 fclose(stdout); 65 66 return 0; 67 }
标签:
原文地址:http://www.cnblogs.com/chxer/p/4483234.html