1
0
Fork 0
You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

29 lines
843 B
C++

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

#include "PartitionPerf.h"
void main()
{
// void timePartition(FILE *fp, int incN, int maxN, int numTrials, char *partitionAlg); //函数声明
int incN = 5; //设置数组初始长度
int maxN=600;
int numTrials = 200;//测试次数
char partitionAlg[20]="Partition"; //算法的名称
char outFileName[20];//测试结果存放的文件名
FILE *fp;
errno_t err;
//创建一个名为partitionAlg[i].txt的文件
strcpy_s(outFileName,partitionAlg);
strcat_s(outFileName,".txt");
err = fopen_s( &fp,outFileName , "a+");
printf( "# Results for %d 次测试" , numTrials);
printf( "# n time (msec)");
printf( "# ---------------\n");
//统计partitionAlg[i]算法对大小为incN2*incN,3*incN,...,maxN的数组进行一次划分的时间
timePartition(fp, incN, maxN, numTrials);
fclose(fp);
printf("done! results in %s\n\n\n\n",partitionAlg);
system("pause");
}