1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30
| void SortCStringList(CStringList & cslListe)
{
POSITION pos, memPos, minPos;
CStringList cslTmp;
CString ligne, ligneMin;
int i,
ln = cslListe.GetCount();
for (i=0;i<ln; i++)
{
ligneMin = cslListe.GetHead();
for( pos = cslListe.GetHeadPosition(); pos != NULL; )
{
memPos = pos;
ligne = cslListe.GetNext( pos );
if (ligne < ligneMin)
{
ligneMin = ligne;
minPos = memPos;
}
}
cslListe.RemoveAt(minPos);
cslTmp.AddTail(ligneMin);
}
for( pos = cslTmp.GetHeadPosition(); pos != NULL; )
{
cslListe.AddTail(cslTmp.GetNext(pos));
}
} |