forked from pn8rjlxip/System
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.
24 lines
559 B
24 lines
559 B
void AsSortbyNum(STU stu[], int n, int m)
|
|
{
|
|
int i, j, k, t;
|
|
for (i=0; i<n-1; i++)
|
|
{
|
|
k = i;
|
|
for (j=i+1; j<n; j++)
|
|
{
|
|
if (stu[j].num < stu[k].num) k = j;
|
|
}
|
|
if (k != i)
|
|
{
|
|
for (t=0; t<m; t++)
|
|
{
|
|
SwapFloat(&stu[k].score[t], &stu[i].score[t]);
|
|
}
|
|
SwapFloat(&stu[k].sum, &stu[i].sum);
|
|
SwapFloat(&stu[k].aver, &stu[i].aver);
|
|
SwapLong(&stu[k].num, &stu[i].num);
|
|
SwapChar(stu[k].name, stu[i].name);
|
|
}
|
|
}
|
|
}
|