I have an array of booleans each representing a number. I am printing each one that is true
with a for loop: for(unsigned long long l = 0; l<numt; l++) if(primes[l]) cout << l << endl;
numt
is the size of the array and is equal to over 1000000. The console window takes 30 seconds to print out all the value, but a timer I put in my program says 37ms. How do I wait for all the values to finish printing on the screen in my program so I can include that in my time.
Try this:
#include <windows.h>
...
int main() {
//init code
double startTime = GetTickCount();
//your loop
double timeNeededinSec = (GetTickCount() - startTime) / 1000.0;
}