#includestdio.h //预编译命令
#includeiostream.h
strUCt list//定义结构体
{
int num;
list*next;
};
list*head,*end; //定义全局变量list*creat()//创建链表的函数
{
list*p=NULL;
list*q=NULL;
head=NULL;
int num;
printf("Input number:");
scanf("%d",&num);
while(num!=0)
{
p=new list; //开辟空间
p-num=num;
if(head==NULL)
head=p;
else
q-next=p;
q=p;
scanf("%d",&num);
}
end=q; //将链表的结尾最后一个结点赋给end
end-nex...[ 查看全文 ]