mirror of
https://github.com/renbaoshuo/202401-programming-assignments.git
synced 2024-12-16 15:44:39 +00:00
18 lines
256 B
C
18 lines
256 B
C
|
p = p1;
|
||
|
|
||
|
for (p2 = p1 + 1; p2 < pData + n; p2++) {
|
||
|
if (p2->score > p->score) {
|
||
|
p = p2;
|
||
|
}
|
||
|
}
|
||
|
|
||
|
if (p != p1) {
|
||
|
num = p->num;
|
||
|
p->num = p1->num;
|
||
|
p1->num = num;
|
||
|
|
||
|
score = p->score;
|
||
|
p->score = p1->score;
|
||
|
p1->score = score;
|
||
|
}
|