#include<stdio.h>
#include<malloc.h>
struct student
{
int num;
float score;
struct student *next;
};
#define len sizeof(struct student)
int main()
{
int n=0;
struct student *head,*p1,*p2;
printf("input num score :/n");
p1=(struct student*) malloc(len);
scanf("%d %f",&p1->num,&p1->score);
while(p1->num!=0)
{
n++;
if(n==1)
{
head=p1;
p2=p1;
}
else
{
p2->next=p1;
p2=p1;
}
printf("input num score :/n");
p1=(struct student*) malloc(len);
scanf("%d %f",&p1->num,&p1->score);
}
p2->next=NULL;
printf("the link is :/n");
while(head!=NULL)
{
printf("%d %f/n",head->num,head->score);
head=head->next;
}
return 0;
}