Àý24±àдͨÓõĺ¯Êý£¬¿É¸ù¾ÝÐèÒª½¨Á¢ÈÎÒâ½ÚµãÊýµÄÁ´±í¡£structstudent*creat()/*ÎÞ²ÎÓзµ»ØÖµ*/{structstudent*head=NULL,*p1,*p2;intlen;longn;floats;len=sizeof(structstudent);while(1)/*Ñ»·´ÎÊý²»È·¶¨*/{printf(\number,score:\scanf(\&n,&s);if(n==0)break;/*ÊäÈë0±íʾÊý¾Ý½áÊø*/p1=(structstudent*)malloc(len);©«}return(head);}
©«
while(1)
{printf(\number,score:\scanf(\&n,&s);if(n==0)break;/*ÒÔ0±íʾÊý¾Ý½áÊø*/p1=(structstudent*)malloc(len);
p1->num=n;p1->score=s;/*ת´æÈë½Úµã*/if(head==NULL) head=p2=p1;else { p2->next=p1; p2=p1; }}
p2->next=NULL; /*ĩβÁ´½Ú³ÉÔ±¸³¿Õ*/return(head); /*·µ»ØÁ´±íÍ·Ö¸Õë*/} /*creat*/
/*Êä³ö¸÷½Úµã*/
voidplink(structstudent*head){structstduent*p;inti;
for(i=1;i<=N;i++){if(i==1)p=head;elsep=p->next;
printf(\
i,p->num,p->score);
}
return;}
void plink(struct student *head) /*¸ü¾ßͨÓÃÐÔ*/{ struct student *p;p=head;
while(p!=NULL)
{ printf(\
p->num, p->score);p=p->next;}
return;}
×¢£º±¾ÐÎʽµÄÁ´±íÊä³öº¯Êý¾ßÓÐͨÓÃÐÔ£¬¿ÉÊÊÓ¦ÓÉÓÚɾ³ý»ò²åÈë½ÚµãÒýÆðµÄÁ´±í³¤¶ÈµÄ±ä»¯¡£