C++程序運行時間計算(#include time.h和 #include sys/time.h)


時間緊迫就暫時采用了這種方法計時,后面再進一步總結。

#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


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM