c++计算程序时间

#include<iostream.h>
#include<time.h>
void main()
{
   clock_t start,finish;
   double totaltime;
   start=clock();

   ……                     //把你的程序代码插入到这里面

   finish=clock();
   totaltime=(double)(finish-start)/CLOCKS_PER_SEC;
   cout<<"
此程序的运行时间为"<<totaltime<<"秒!"<<endl;
}
原文地址:https://www.cnblogs.com/AK-ls/p/10221391.html