while(rwlist1->Count>0)这个循环条件具体是怎么进行的?
TStringList *rwlist= new TStringList();
TStringList *rwlist1=new TStringList();
TStringList *rwlist2=new TStringList();
struct raledraw raledraw[20];
while(rwlist1->Count>0)
{ s=rwlist1->Strings[k];
TaskInfo->Locate("任务编号",s,opt);
s1=TaskInfo->Fields->FieldByNumber(6)->AsString;
if(!rwlist2->Find(s1,index)){k++;}
else
{ rwlist->Find(s1,index);
c=raledraw[index].cj;
for(j=7;j<11;j++)
{
if(TaskInfo->Fields->FieldByNumber(j)->AsString.IsEmpty())
{
rwlist->Find(s,index);
raledraw[index].cj=c+1;
raledraw[index].xh=cj[c+1]+1;
cj[c+1]=cj[c+1]+1;
rwlist2->Add(s);
rwlist1->Delete(k);
rwlist1->Sort();
rwlist2->Sort();
k=0;
break;
}
else
{
s1=TaskInfo->Fields->FieldByNumber(j)->AsString;
if(!rwlist2->Find(s1,index)){k++;break;}
else
{
rwlist->Find(s1,index);
c1=raledraw[index].cj;
if(c1>c) {c=c1;}
}
}
}
}
}
[解决办法]
循环的条件是rwlist1->Count>0,循环内有代码rwlist1->Delete(k),当Delete到Count为0的时候,就跳出循环了。