Loop not working

When I run my program the loop (for (R=0; R<=14; R++)) is only running five times and I cannot figure out why.

for ( R=0; R<=14; R++)//running 5 time?
{
sum1=0;
sum2=0;
//Testing 1-70 possible machines down
for(row=0; row<70; row=row+1)
{
if (row < count+1)
{
P[row+1]=Traffic*((NumberMachines-row)/(row+1))*P[row];
}

if (row>=count+1 and row<=NumberMachines)
{
P[row+1]=Traffic*((NumberMachines-row)/(count+1))*P[row];
}
cout<<"Prob "<<P[row+1]<<"\n";
}

for(row=0; row<=70; row++)
{
sum1=sum1+row*P[row];
sum2=sum2+P[row];
}

Md=sum1/sum2;
cout<<"Md "<<Md<<"\n";
TotalCostGF=((count*HourlyFastRates)+(Md*CostInopMachines));

if (min < TotalCostGF)
{
R=Rmin;
TotalCostGF=TotalMin;
}
}
Last edited on
 
R=Rmin;


Why are you changing R inside your loop?

PLEASE USE CODE TAGS (the <> formatting button) when posting code.
http://v2.cplusplus.com/articles/jEywvCM9/
It makes it easier to read your code and it also makes it easier to respond to your post.
Hint: You can edit your previous post, highlight your code and press the <> formatting button.
Topic archived. No new replies allowed.