【发布时间】:2014-01-22 19:55:35
【问题描述】:
我不知道这是不是基本的,但我只知道如何按升序排序。
system("cls");
if (headptr != (struct online*)NULL)
{
currentptr = headptr;
for(; currentptr->ptrnext != NULL; currentptr = currentptr->ptrnext)
{
for(newptr = currentptr->ptrnext; newptr != (struct online*)NULL; newptr = newptr->ptrnext)
{
if(currentptr->score > newptr->score)
{
int temp = currentptr->score;
currentptr->score = newptr->score;
newptr->score = temp;
}
}
}
}
【问题讨论】:
-
其中哪一部分负责对订单做出决定?什么是补充操作?
-
重复了这么多问题...您尝试过:stackoverflow.com/questions/5526750/linked-list-sorting-in-cstackoverflow.com/questions/11813696/sorting-a-linked-list-in-c 还是简单的谷歌?如果您可以按升序对其进行排序,则只需颠倒您的比较以颠倒顺序,就像这里提到的答案一样。
标签: c sorting linked-list