I've followed an example from a website on how to use diff time, however its telling me that it took 0 seconds which obviously isn't right...can anyone please explain what I'm doing wrong?
Thanks in advance!
int main()
{
time_t t1, t2;
double dif;
Matrix A(2);
Matrix B(2);
A.SetElement(1,1,1);
A.SetElement(1,2,2);
A.SetElement(2,1,3);
A.SetElement(2,2,4);
B.SetElement(1,1,5);
B.SetElement(1,2,6);
B.SetElement(2,1,7);
B.SetElement(2,2,8);
for (int i = 0; i < 5; i++)
{
time(&t1);
A.Multiply(B);
time(&t2);
dif = difftime(t2,t1);
cout << "This took "<< dif << " seconds" << endl;
}
return 0;
}