How can I make my own timer without standard library?
问题 Is there some specific number of iterations, that I could make using a for loop , so that it exactly takes 1 second for the loop to be executed completely? For example the following code took 0.125s on my machine to execute: #include <iostream> #include <cmath> using namespace std; int main(){ long long a=0; for (a=0;a<=pow(10,4);a++); } Though, a <= 8*pow(10,4) took 0.206 s. Compiler is GCC 4.9.2. IDE is codeblocks. My PC's Specs: OS: Windows 8.1 回答1: I am posting this answer to your