#include<iostream.h>
struct Student
//结构声明
{
//定义结构变量
int id;
char name[20];
char sex[10];
int age;
Student *next;
};
Student *head;
Student *a[10];
Student *Create()//创建链表结构
{
Student *s,*p;
s=new Student;
cin>>s->id>>s->name>>s->sex>>s->age;
head=NULL;
while(s->id!=0)
{
if(head==NULL)
head=s;
else
p->next=s;
p=s;
s=new Student;
cin>>s->id>>s->name>>s->sex>>s->age;
}
p->next=NULL;
delete s;
return head;
}
void paixu(head)//插入法排序
{
Student *st,*pt;
while(pt!=NULL)
{
//用插入法怎么排序?
}
}
void showList(Student *head)
{
while(head)
{
cout<<"now the items of list are\n";
cout<<head->id<<head->name<<head->sex<<head->age;
head=head->next;
}
}
main()
{
head=Create();
paixu(head);
showList(head);
}