利用以下的实例来引入单链表的冒泡排序(有注释)
设计一个菜单,具有功能:1.输入任意数量的学生信息(存储大小允许下);
2.修改指定学生的成绩;
3.对学生的成绩冒泡排序(两种做法)
以下为代码部分:
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
//定义信息
typedef struct menu
{
/* data */
char id[80];
char name[80];
int score1;
int score2;
int score3;
int score4;
float average;
int sum;
}info;
//定义节点
typedef struct node{
info item;
struct node * next;
}Node;
Node *addList(Node **head,Node *tail);
void print1(Node *head);
void revise(Node **head);
void cal(Node **head);
void print2(Node *head);
void print3(Node *head);
void BubbleSort(Node *head);//按照平均成绩进行冒泡排序
int main()
{
int choice;
Node *head=NULL,*tail;
while(1){