時間緊迫就暫時采用了這種方法計時,后面再進一步總結。
#include <iostream>
#include <time.h>
using namespace std;
int main()
{
time_t start, end;
time(&start);
system("pause");
time(&end);
system("pause");
cout << end - start << endl;
return 0;
}
參考:
1.測試C/C++程序運行時間
2.#include time.h和 #include sys/time.h
3.GetLocalTime
4.C++ time(NULL) 計算持續的時間長度
5.time(NULL)的用法
6.c++ 時間類型詳解 time_t
7.徹底搞清楚C/C++中日期和時間 time_t與struct tm,time(NULL),ctime;strftime