我也是刚学的。。。。
对拍器组成:
1.高效代码:my.exe
2.正确代码:check.exe
3.数据生成器:rand.exe
4.批处理文件:test.bat
主要是批处理文件:
@echo off
:loop
rand.exe>data.in
my.exe<data.in>my.out
check.exe<data.in>check.out
fc my.out check.out
if not errorlevel 1 goto loop
pause
goto loop
举例:1到n的和
my:
#include<iostream>
using namespace std;
main()
{
int n;
cin >> n;
cout << (n + 1) * n / 2 << endl;
}
check:
#include<iostream>
using namespace std;
main()
{
int n, sum = 0;
cin >> n;
for(int i = 1; i <= n; i++)
sum += i;
cout << sum << endl;
}
rand:
#include<iostream>
#include<cstdlib>
#include<ctime>
using namespace std;
main()
{
srand((int)time(NULL));
cout << 1 + rand() % 10000000 << endl;
}
my.exe, check.exe, rand.exe, test.bat放在同一路径下。