+ 1

How to make stopwatch in c++

Stopwatch

20th Feb 2017, 2:44 PM
Vitesh Topiwala
Vitesh Topiwala - avatar
2 Answers
+ 11
A hint would be to look into <ctime> or <chrono>. Get the time upon begin point, then store it inside a variable. Get the time upon completion point and store it inside another variable. Deduct the latter with the former, and convert to seconds.
20th Feb 2017, 5:18 PM
Hatsy Rei
Hatsy Rei - avatar
+ 9
It's better to use modern time libraries, like <windows.h>, which are more precise than <ctime> :)
20th Feb 2017, 6:27 PM
Jafca
Jafca - avatar