forked from pn8rjlxip/System
parent
7fd5aeceb9
commit
1e1641551f
@ -0,0 +1,23 @@
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in new issue