计算程序运行的时间

Posted fo0o0ol

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了计算程序运行的时间相关的知识,希望对你有一定的参考价值。

 1 #include <ctime>
 2 #include <iostream>
 3 int main() 
 4    clock_t start, finish;
 5    double total_time;
 6    start = clock(); 
 7    //put your code here
 8    finish = clock();
 9    total_time = (double)(finish - start) / CLOCKS_PER_SEC;
10    printf("%fs\n", total_time);
11 

 

以上是关于计算程序运行的时间的主要内容,如果未能解决你的问题,请参考以下文章