I am slowing down the execution of the if statement in this way. But I do not like him.
for (size_t i = 0;;) {
i = (i + 1) % 1000000;
if (i == 10) {
cout << " TEST " << "\n" << endl;
}
}
I would like to make the code on time. Until one minute passes, the if statement should always be passed by.
How can this be realized?
for (;;) {
/* do something */
if (one_minute_elapsed_since_first_iteration) {
/* do something else */
}
}
And one more question will it work faster than the first option?