sorry,有点笔误
int N = 5;//序列长度+1,现在仅定为4,即a,b,c,d重复出现
//ListView1事先加入了5个ListItem,一个Column,设为vsReport,
int i,start = 0;
char cha1,tchar;
while(!q->Eof) //q为TTable
{
tchar = 'a' - 1;
start = 1;
do
{
cha1 = q->Fields->Fields[0]->AsString[1];
if(cha1 > tchar)
{
for(i = start; i < start + cha1 - tchar - 1; i++)
ListView1->Items->Item->SubItems->Add("");
ListView1->Items->Item[cha1 - 'a' + 1]->SubItems->Add(q->Fields->Fields[1]->AsString);
start = i + 1;
tchar = cha1;
q->Next();
}
else
{
for(i = start; i < N; i++)
ListView1->Items->Item->SubItems->Add("");
break;
}
}
while(true);
}