#include<iostream>
using namespace std;
class Node
{
public:
Node():next(NULL){}
Node(int n,Node *p = NULL):value(n),next(p){}
int value;
Node *next;
};
class List
{
public:
static int len; //对链表的长度进行累积
List():m_pHead(NULL),m_pTail(NULL){};
~List(){Clear();};
void InsertHead(int v) //头部插入
{
Node *p = new Node(v);
if(m_pHead == NULL)
{
m_pHead=p;
m_pTail=p;
}
else
{
p->next = m_pHead;
m_pHead = p;
}
++len;
}
void InsertTail(int v) //尾部插入
{
Node *p = new Node(v);
if(m_pHead==NULL)
{
m_pTail=m_pTail=p;
}
else
{
m_pTail->next=p;
m_pTail=p;
}
++len;
}
void InsertPosValue(int p,int v) //在p位置插入v值
{
Node *s = new Node(v);
Node *x=m_pHead;
int n=1;
Node *q=GetIp(p);
if(q==NULL)
return;
else
using namespace std;
class Node
{
public:
Node():next(NULL){}
Node(int n,Node *p = NULL):value(n),next(p){}
int value;
Node *next;
};
class List
{
public:
static int len; //对链表的长度进行累积
List():m_pHead(NULL),m_pTail(NULL){};
~List(){Clear();};
void InsertHead(int v) //头部插入
{
Node *p = new Node(v);
if(m_pHead == NULL)
{
m_pHead=p;
m_pTail=p;
}
else
{
p->next = m_pHead;
m_pHead = p;
}
++len;
}
void InsertTail(int v) //尾部插入
{
Node *p = new Node(v);
if(m_pHead==NULL)
{
m_pTail=m_pTail=p;
}
else
{
m_pTail->next=p;
m_pTail=p;
}
++len;
}
void InsertPosValue(int p,int v) //在p位置插入v值
{
Node *s = new Node(v);
Node *x=m_pHead;
int n=1;
Node *q=GetIp(p);
if(q==NULL)
return;
else