c++可以使用很多方法,获取 程序某个模块 消耗的时间。这里提供一种简单方法,精度为 毫秒
#include <iostream>
#include <ctime>
using namespace std;
int main()
{
int start = clock();
//Todo something
//...
cout<<"耗费时间:"<<double(clock()-start)/CLOCKS_PER_SEC<<endl;//宏CLOCKS_PER_SEC==1000
system("pause");
return 0;
}
C++ 讨论群:506八 790五