#include <iostream>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <algorithm>
using namespace std;
int main()
{
FILE *f1,*f2;
while(1)
{
system("datamaker");
int tmp=system("baoli");
if(tmp!=0) printf("暴力程序运行错误\n");;
tmp=system("ceshi");
if(tmp!=0) printf("被测试程序运行错误\n");
f1=fopen("out_baoli","r");
f2=fopen("out_ceshi","r");
if(!f1)
{
printf("找不到暴力的输出文件\n");
while(1);
}
if(!f2)
{
printf("找不到被测试程序的输出文件\n");
while(1);
}
while(!feof(f1)&&!feof(f2))
{
char ch1=getc(f1),ch2=getc(f2);
while((ch1==' '||ch1=='\n')&&!feof(f1)) ch1=getc(f1);
while((ch2==' '||ch2=='\n')&&!feof(f2)) ch2=getc(f2);
if(ch1!=ch2)
{
printf("两输出文件不一致\n");
while(1);
}
}
printf("运行结果比对正确\n");
}
return 0;
}
省选对拍用代码
最新推荐文章于 2017-10-23 21:27:35 发布