利用標(biāo)準(zhǔn)庫(kù) time 可以實(shí)現(xiàn)以毫秒為最小單位的計(jì)時(shí)操作

#include <time.h>
using namespace std;

int main() {
 clock_t start, finish;
 
double duration;
 start 
= clock();
 execute();
 finish 
= clock();
 duration 
= (double)(finish - start) / CLOCKS_PER_SEC; //
 cout << "time is " << duration << endl;
 
return 0;
}

//被雷到了,居然有c#沒(méi)有c++


更多關(guān)于c++時(shí)間操作的信息看這
http://www.cnitblog.com/ictfly/archive/2007/01/15/21886.html