clock()函数

函数名:clock()

头文件:time.h

返回变量:clock_t 类型变量

相关常量:CLOCKS_PER_SEC ( =  clock_t  1000)

使用:

#include <cstdio>
#include <ctime> 

int main()
{
    clock_t first = clock();
    //测试语句 
    clock_t end = clock();
    printf("%f\n", (double) (end - first)/CLOCKS_PER_SEC);
    return 0;
}

 

posted @ 2022-01-20 10:10  the_sky314  阅读(69)  评论(0编辑  收藏  举报