代码:
char temp[20];
for (int i = 0; i < n-1; i++)//比较法排序,共有n个元素
{
for (int j = i + 1; j < n; j++)
{
if (strcmp(c[i], c[j]) > 0)
{
strcpy(temp, c[i]);
strcpy(c[i], c[j]);
strcpy(c[j], temp);
}
}
}