the follow code is to test how long to run the loop
i wanna print the time as millisecond format
but the result of console is always 0.000
anyone can help me?
#include <cstdlib>
#include <iostream>
#include <time.h>
using namespace std;
int main(int argc, char *argv[])
{
int a[500][500];
int xx=10;
int i = 0 , j = 0;
for(i=0;i<500;i++)
for(j=0;j<500;j++)
a[i][j]=i;
clock_t startTime =clock();
for(i=0;i<500;i++)
for(j=0;j<500;j++)
xx=a[i][j];
cout<<"total time is:"<<( endTime - startTime ) /
CLOCKS_PER_SEC<<endl;
clock_t endTime = clock();
system("PAUSE");
return EXIT_SUCCESS;
}