仍然是简单的作业系列。。。。注意一下p2=p1
还有scanf&
#include<stdio.h>
#include<malloc.h>
#define len sizeof(struct student)
struct student
{
int num;
float score;
struct student*next;
}a,b,c;
int main()
{
int n=0;
struct student*p,*p1,*p2,*head;
p1=p2=(struct student*)malloc(len);
scanf("%d%f",&p1->num,&p1->score);
while(p1->num!=0)
{
n=n+1;
if(n==1) head=p1;
else p2->next=p1;
p2=p1;
p1=(struct student*)malloc(len);
scanf("%d%f",&p1->num,&p1->score);
}
p2->next=NULL;
p=head;
do
{
printf("%d %.1f\n",p->num,p->score);
p=p->next;
}while(p!=NULL);
return 0;
}