Wednesday 20 November 2013

tools: Time check in C++

#include<iostream>
#include<time.h>
using namespace std;

int main()
{
time_t beg, end;
time(&beg);

for(int y=0; y<100; y++)
{

}

time(&end);
double dif = double(end - beg) / CLOCKS_PER_SEC;
cout <<"total time spended: " <<dif <<endl<<endl<<endl;
}



No comments:

Post a Comment