Timing a program

Is there a way to implement a clock into a program so that it outputs how long it took to execute the program?

Like lets so I have a guess my number game. And Im having the computer guess my number. And I want to found outhow long it takes to guess so number so that it outputs something

 
  cout << "It took the computer __ seconds and __ tries to guess your number." << endl;
closed account (2AoiNwbp)
You have the clock function
http://www.cplusplus.com/reference/ctime/clock/?kw=clock
Thank you
Topic archived. No new replies allowed.