I have a while loop that runs around 10 million times incrementing a variable “day” every time. I want the program to only print a line when a million days has passed (i.e.
1 million days have passed
2 million days have passed
…
Loop is done
so far I have the code:
double dayMill; //outside the loop
...
dayMill = day/1000000; //every runthrough of the loop
I was thinking about using an if statement with with things like
if( (int)dayMill == dayMill){}
because when day = 1,000,000 then daymill = 1 so cast as an int it is 1 as well. However this doesn’t work. It prints 0.0 million days… a lot until 1.0 a lot….. never just the one line for each million i want
That is if you make dayMill an int. Why is it a double if you are incrementing by one? I guess I do not really understand what you are doing exactly.