This is my code:
double sec = 0;
while (1)
{
sec += 0.01;
Sleep(10);
cout << sec << endl;
}
I want to make a stopwatch. I used the Sleep
function to increase variable every 10ms, but output variable doesn't match with the computer's stopwatch.
- Can you tell me a reason?
- and is there any other way to make a stopwatch?