x=0;
t=0;
int t2=0,t3;
while(t<=ref)
{t3=t2;
for(x=0;x<jbn;x++)
{ if(t==cpy2[x].at)
{
if(q>=cpy2[x].bt)
{
t2+=cpy2[x].bt;
tt[x++]=t2;
cpy2[x].bt=0;
qq++;
}
else if(q<cpy2[x].bt)
{
t2+=q;
cpy2[x].bt-=q;
cpy2[x].at=t2;
qq++;
}
}
else
break;
}
t++;
if(t3==t2)
{t2++;}
};
assuming the values are
cpy2[0].at==1
cpy2[0].bt==2
cpy2[1].at==2
cpy2[1].bt==3
cpy2[2].at==4
cpy2[2].bt==4
q==2
qq is just an add on
jbn==3
and
ref==10
the results are tt[]={3,5,9}
but we want tt[]={3,8,10}
can you help?
p.s.
dont suggest to initialize tt[] by that.... we need process!!