# indude <malloc.h> # define NULL 0 # define LEN sizeof(struct student) struct student {long num; char name[10]; char sex[2]; int English; int Marth; int Lead; int Sum; float Ave; struct student *next; }
int n; struct student *creat(void) {struct student *head; struct student *p1,*p2; n=0; p1=p2=(struct student *)malloc(LEN); scanf("%ld,%s%s%d%d%d",&pi->num,&pi->name,&pi->sex,&pi->English,&pi->Marth,&pi->Lead,); head=NULL; while pi->num!=0) {n=n+1; if(n==1) head=p1; else p2->next=p1; p2=p1; p1=(struct student *)malloc(LEN); scanf("%ld,%s%s%d%d%d",&pi->num,&pi->name,&pi->sex,&pi->English,&pi->Marth,&pi->Lead,); } p2->next=NULL; return(head); }
后面我不知道怎么写了,可以告诉我啊