I have a simple for() loop in a program that I am writing. This for() loop is the slow part of the program, so when modifications are made to the length of the loop, the effects are easy to observe.

The function in question approximates as follows:

Code:
void function()
            {int x;
            double num;
            cin>>num;
            cout<<"        ";  // 8 spaces (8 spaces = 1 tab)
            for(x=0; x<num; x++)
                           {if(x%10==0)
                                        {cout<<"\b\b\b\b\b\b\b\b"<<x/num<<\t%;}
                           <repeated algorithms>}}
Using the embedded if() statement, I can monitor how often the for() loop repeats 10 iterations (at which time the percent of for() loop iterations is displayed).
It seems to me that, because the algorithms never change, the length of time between percentage displays should be the same regardless of the value entered for num (though the entire process will take longer for larger values of num).
However, for some reason, this is not the case: As it turns out in my case, the value num does not only affect the total time required to complete the for() loop, but it also affects how long it takes for each algorithm to finish (even though the algorithm is independant from the value of num).

For example, in my case, when num is equal to 10, the loop takes only 1 second to finish, with milliseconds between each percentage display. However, when num is equal to 200, it takes about 10 seconds to finish each iteration of the for() loopl

Forgive me if my question is ambiguous.
Can anyone explain why this occurs, and offer a possible solution?


Thank you
Andy
abarrette@nc.rr.com