#include <stdio.h>
#include <stdlib.h>
#define null 0
typedef struct snode
{
char *name;
char *no;
int score[5];
}typedefdata;
typedef struct node
{
typedefdata data;
struct node *next;
}linklist;
linklist *insert_new()
{
char flag;
int x;
char *na;
char *num;
int grade[5];
linklist *head,*rear,*p;
head = (struct node*)malloc(sizeof(linklist));//头节点的空间分配
rear = head;//头尾相连进行初始化
do{//do-while语句保证至少进行一次。
printf("name:");
scanf("%s",&na);
printf("No.:");
scanf("%s",&num);
printf("yuwen_grade:");
scanf("%d",&grade[0]);
printf("shuxue_grade:");
scanf("%d",&grade[1]);
printf("yingyu_grade:");
scanf("%d",&grade[2]);
printf("zhengzhi_grade:");
scanf("%d",&grade[3]);
printf("tiyu_grade:");
scanf("%d",&grade[4]);
p = (struct node*)malloc(sizeof(linklist));
p->data.name = na;
p->data.no = num;
for(x=0;x<5;x++)
p->data.score[x] = grade[x];
rear->next = p;
rear = p;
printf("\n\n continue?q for quit!");
getchar();
scanf("%c",&flag);
}while(flag != ‘q‘);
rear->next = null;
return (head);
}
for(x=0;x<5;x++)
p->data.score[x] = grade[x];
p->next = head->next;
head->next = p;
printf("\n\n continue?q for quit!");
int main()
{
insert_new();
return 0;
}