Name: Anonymous 2007-11-19 2:00
C++
for (int k = 0; k < 10; k++)
{ if(boyName[fileCount][babyCount].at(k)> boyName[fileCount][babyCount+1].at(k))
{
temp = boyName[fileCount][babyCount];
boyName[fileCount][babyCount] = boyName[fileCount][babyCount+1];
boyName[fileCount][babyCount+1] = temp;
}
}
someone tell me why this bit of code won't work?
i'm comparing strings and alphabetizing them (about 10000 stored in an array)
if k is initialized to 0 and it's not a for loop it'll run fine, and alphabetize it but only by the first letter.
for (int k = 0; k < 10; k++)
{ if(boyName[fileCount][babyCount].at(k)> boyName[fileCount][babyCount+1].at(k))
{
temp = boyName[fileCount][babyCount];
boyName[fileCount][babyCount] = boyName[fileCount][babyCount+1];
boyName[fileCount][babyCount+1] = temp;
}
}
someone tell me why this bit of code won't work?
i'm comparing strings and alphabetizing them (about 10000 stored in an array)
if k is initialized to 0 and it's not a for loop it'll run fine, and alphabetize it but only by the first letter.