天天看點

程式計時代碼

#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;