- 22
- 0
- 约5.32万字
- 约 6页
- 2016-12-25 发布于河南
- 举报
C++中关于链表一例题
#include stdio.h
#include stdlib.h
typedef struct link
{
int sum;
struct link *next;
} lnode;
lnode *Creat(int n) //建立函数
{
lnode *p1,*p2,*head;
int i=0;
head = NULL;
p1=p2=(lnode *)malloc(sizeof(lnode));
scanf(%d,p1-sum);
while(in)
{
i++;
if(i==1)
head=p1;
else
p2-next=p1;
p2=p1;
p1=(lnode *)malloc(sizeof(lnode));
scanf(%d,p1-sum);
}
p2-next=p1;
p1-next=NULL;
return(head);
}
lnode *Insert(lnode *head,lnode *New,int x) //插入函数
{
lnode *Pointer;
Poin
原创力文档

文档评论(0)