C语言中求程序运行时间
首先,包含头文件
#include <time.h>
其次,在程序中建立两个监测端点
clock_t stime = clock(); //开始计时
MathFunObj.eleCofactor(mult, n, 1, 1, cofMat);
clock_t etime = clock(); //结束计时
printf("running time is :%d ms\n", etime-stime);
注意关键词:clock_t
获得的结果只能是ms级的,这是由于计算机(PC)最小计算单位是ms