This is a basic outline of my program here:
#include <iostream.h>
#include <sys/types.h>
#include <stdlib.h>
#include <time.h>
#include <math.h>
main () {
int i; time_t t1, t2;
.... all variables, etc. go here
(void) time (&t1);
... entire code goes here
(void) time (&t2);
cout<<"CPU time required to execute the program "<<(int) t2-t1<<endl;
}
The problem I am having is that I get a value of "0" for time required to execute the program. I am working in C++ and don't know how this problem can be fixed... I've tried to use different types for the time statement, float, double, but nothing seems to work. Does anyone else have suggestions or a better way to execute this?? thanks in advance