include<ctime>

time_t begin,end;
 
 begin=clock();

{

.............//被测试的代码

}

end=clock();
 cout<<"运行时间: "<<double(end-begin)/CLOCKS_PER_SEC<<endl;

********

*****注意得到的时间单位为s,所以精度不是很高。

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2021-09-28
  • 2022-12-23
  • 2022-12-23
  • 2021-08-13
  • 2021-12-15
  • 2021-11-22
猜你喜欢
  • 2021-11-15
  • 2021-12-15
  • 2022-12-23
  • 2022-12-23
  • 2021-10-15
  • 2022-12-23
  • 2021-12-18
相关资源
相似解决方案