|
- void g(struct t *head)
- {
- struct t *p,*q,*k;
- int x,y;
- for(x=0;x<N-1;++x)
- { p=head;printf("%.2f %.2f %.2f\n",head->next->money,head->next->next->money,head->next->next->next->money);
- for(y=0;y<N-x-1;++y)
- {if(p->next->money<p->next->next->money)
- {q=p->next;
- k=p->next->next->next;
- p->next=p->next->next;
- p->next->next=q;
- p->next->next->next=k;}
- printf("%.2f %.2f %.2f\n",p->next->money,p->next->next->money,p->next->next->next->money);
- p=p->next;
- }
- }
- }
复制代码
运行结果只有一次交换
|
本帖子中包含更多资源
您需要 登录 才可以下载或查看,没有账号?立即注册
x
|