c++耗時測試

c++耗時測試

#include<time.h>
 
using namespace std;
 
int TestTimeCost()
{
	clock_t startTime,endTime;
	startTime = clock();
	for (int i = 0; i < 1000000; i++)
	{
		i++;
	}
	endTime = clock();
	cout << "Totle Time : " <<(double)(endTime - startTime) / CLOCKS_PER_SEC << "s" << endl;
	system("pause");
	return 0;
}
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章