int main()
{ student *creat(void);
student *del(student *,long);
student *insert(student *,student *);
void print(student *);
student *head,*stu;
long del_num;
cout<<"input records:"<<endl;
head=creat(); //返回头指针
print(head); //输出全部结点
cout<<endl<<"input the deleted number:";
cin>>del_num; //输入要删除的学号
while(del_num!=0)
{head=del(head,del_num); //删除后链表的头地址
print(head); //输出全部结点
cout<<"input the deleted number:";
cin>>del_num;
}
cout<<endl<<"input the inserted record:"; //输入要插入的结点
stu=new student; //开辟一个新结点
cin>>stu->num>>stu->score;
while(stu->num!=0)
{head=insert(head,stu); //返回地址
print(head); //输出全部结点
cout<<endl<<"input the inserted record:"; //输入要插入的结点
stu=new student;
cin>>stu->num>>stu->score;
}
return 0;
}
student *creat(void) //建立链表的函数
{student *head;
student *p1,*p2;
n=0;
p1=p2=new student; //开辟一个新单元,并使 p1,p2 指向它
cin>>p1->num>>p1->score;
3