You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
System/z11

23 lines
512 B

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

// 11函数功能交换法实现字符串按字典顺序排序
void SortbyName(STU stu[], int n, int m)
{
int i, j, t;
for (i = e; i <n - 1; i++)
{
for (j = i + 1; j <n; j++)
{
if (strcmp(name[j],name[i]) < 0)
{
for (t =e; t<m;t++) /*交换m门课程的成绩*/
{
SwapFloat(&score[i][t]&score[j][t]);
}
SwapFloat(&sum[i]&sum[j]); /*交换总分*/
SwapFloat(&aver[i]&aver[j]); /*交换平均分 */
SwapLong(&num[i]&num[j]); /*交换学号 */
SwapChar(name[i]name[j]); /*交换姓名 */
}
}
}
}