#include <stdio.h>
#include <stdlib.h>
#include <iostream.h>
struct Node{
int data;//数据域
struct Node * next;//指针域
};
/**************************************************************************************
*函数名称:Create
*函数功能:创建链表.
*输入:各节点的data
*返回值:指针head
*************************************************************************************/
Node * Create()
{
int n = 0;
Node *head,*p1,*p2;
p1=p2= new Node;
cin>>p1->data;
head = NULL;
while(p1->data!=0)
{
if(n == 0)
{
head = p1;
}
else
p2->next = p1;
p2 =p1;
p1 = new Node;
本内容试读结束,登录后可阅读更多
下载后可阅读完整内容,剩余2页未读,立即下载