Link to home
Start Free TrialLog in
Avatar of demami
demami

asked on

clock problem for Answer 2000

Here is my problem. How can I modify this code to time the "enter" operation? I'm using the Stopwatch class unmodified to do the timing. I'm looking for the program to print the total time, the average time per "enter" and the min and max time for the "enter"operations.

while (cin>>name)
{

table.enter(name);

}
--------------------------
class Stopwatch
{public:
Stopwatch() : sum (0) {}
void start() {begin = clock();}
double stop() {double res = (double) (clock()-begin);
              sum += res;
              return res / CLOCKS_PER_SEC;
              }
double total() {return sum / CLOCKS_PER_SEC;}
private:
   double sum;
   clock_t begin;
};
ASKER CERTIFIED SOLUTION
Avatar of Answers2000
Answers2000

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial