天天看点

程序计时代码

#include<ctime> //头文件

  clock_t startTime, endTime;
  startTime = clock();//计时开始
  
   。。。。。(需要计时的部分程序)
 
  endTime = clock();//计时结束
  std::cout << "the run time is:" << (double)(endTime - startTime) / CLOCKS_PER_SEC << "s" << std::endl;