数据结构-多项式
#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;
}
posted on 2018-05-25 18:26 Mint-Tremor 阅读(143) 评论(0) 编辑 收藏 举报