对拍程序
因为今天打比赛队友对拍出了一个错误结果,所以我也趁机自己写了一番这个一直没有实现的技术,用起来还是很舒爽的。
1#include <iostream>
2
3int main(int argc, const char * argv[]) {
4 system("g++ ~/Desktop/data/data/main.cpp -std=c++11 -o data.out");
5 system("g++ ~/Desktop/T/T/main.cpp -std=c++11 -o T.out");
6 system("g++ ~/Desktop/ttt/ttt/main.cpp -std=c++11 -o ttt.out");
7
8 int times = -1;
9 scanf("%d", ×);
10 int cnt = 0;
11 while(times != 0){
12 times--;
13 system("./data.out >~/Desktop/in.txt");
14 system("./T.out < ~/Desktop/in.txt > ~/Desktop/out.txt");
15 system("./ttt.out < ~/Desktop/in.txt > ~/Desktop/ans.txt");
16 if(system("diff ~/Desktop/out.txt ~/Desktop/ans.txt")){
17 puts("Differences occur!");
18 break;
19 }
20 printf("No.%d's OK.\n", cnt++);
21 }
22 return 0;
23}