#include<iostream>
using namespace std;
#define max 100
typedef struct lnode* list;
typedef int ElementType;
struct lnode
{
ElementType date[max];
int last;
};
list makeempty()
{
list ptrl;
ptrl = (list)malloc(sizeof(struct lnode));
ptrl->last = -1;
return ptrl;
}
int find(ElementType x,list ptrl)
{
int i = 0;
while (i <= ptrl->last&&ptrl->date[i]!= x)
{
i++;
}
if (i > ptrl->last)
return -1;
else
return i;
}
void insert(ElementType x,int i,list ptrl)
{
int j;
if (ptrl->last == max - 1)
{
cout << "man";
return;
}
if (i<1 || i>ptrl->last + 2)
{
cout << "buhefa";
return;
}
for (j = ptrl->last; j > i - 1; j--)
ptrl->date[j + 1] = ptrl->date[j];
ptrl->date[i - 1] = x;
ptrl->last++;
}
bool Delete(list ptrl, ElementType p)
{
int i;
if (p<0 || p>ptrl->last + 1)
{
cout << "buhefa";
return false;
}
for (i = p + 1; i <= ptrl->last; i++)
ptrl->date[i - 1] = ptrl->date[i];
ptrl->last--;
return true;
}