程序模板:
#include <stdio.h>
#include <time.h>
//clock_t是clock()函数返回的变量类型
clock_t start,stop;
//记录被测函数运行时间,以秒为单位
double duration;
int main()
{
start = clock();//开始计时
MyFunction();//把被测函数加在这里
stop = clock();//停止计时
duration = ((double)(stop - start))/CLK_TCK;
return 0;
}