#include <stdio.h>#include <stdlib.h>#define LEN sizeof(struct student)struct student//定义结构体类型{ long num; char name[20]; float score; struct student* next;};int n;int main()//程序{ struct student* creat(void);//动态链表函数声明 void output(struct student* head);//输出链表函数声明 int max(); //struct student* p0; //p0 = creat(); //n = 0; //output(p0); creat(); max(); return 0;}struct student* creat(){ struct student* head, * p1, * p2; p2 = 0; head = NULL; printf("请输入学生信息:学号 姓名 成绩:\n"); while (1) { p1 = (struct student*)malloc(LEN); if (!p1) return 0; p1->next = NULL; scanf_s("%ld %s %f", &p1->num, &p1->name, 20, &p1->score); if (p1->num == 0) break; n++; if (n == 1) head = p1; else if (!p2) return 0; else p2->next = p1; p2 = p1; } return head;}void output(struct student* head)//输出链表函数{ struct student* p; p = head; n = 0; if (head != NULL) do { printf("%ld,%s,%f\n", p->num, p->name, p->score); p = p->next; n++; } while (p != NULL);}int max(){ struct student* p; struct student head; p =&head; int i, j; float a[LEN], t; for (i = 0; i < (int)LEN; i++) a[i] = p->score; for (j = 0; j < (int)LEN; j++) for (i = 0; i<(int)LEN - j; i++) if (a[i] > a[i + 1]) { t = a[i]; a[i] = a[i + 1]; a[i + 1] = t; } for (i = 0; i < (int)LEN; i++) printf("%f", a[i]); return 0;}