怎样知道程序运行消耗的时间

    技术2025-05-24  32

     #include<stdio.h> #include<stdlib.h> #include<string.h> #include"time.h" #define inf 100000000 #define CLOCKS_PER_SEC ((clock_t)1000)  int main()//注意是int {     double duration;     clock_t start,finish;     start=clock();

      /*这里是主程序的代码*/

         finish=clock();     duration=(double)(finish-start)/CLOCKS_PER_SEC;     printf("%lf seconds/n",duration);     return 0; }

     

     

     

    最新回复(0)