数据结构-多项式

#include<stdio.h>
#include<time.h>


clock_t start, stop;     //clock_t是clock()函数返回的变量类型
double duration;        //记录被测函数运行时间,以秒为单位

int main2()
{                               //不在测试范围内的准备工作写在clock()调用之前
start = clock(); //开始计时
printf("hello world\n");                                                 //把函数加在这里
stop = clock(); //停止计时
duration = ((double)(stop - start)) / CLK_TCK;            //计算运行时间
printf("%d %d %d", start, stop, duration);

                                  //其他不在测试范围的处理写在后面,例如输出duration的值
getchar();
return 0;

}

猜你喜欢

转载自www.cnblogs.com/minTTremor/p/9090192.html