#include<iostream>
typedef int DataType;
typedef int Status;
#define MaxSize 100
typedef struct
{
DataType data[MaxSize];
int length;
}SeqList;
#define TRUE 1
#define FALSE 0
#define OK 1
#define ERROR 0
using namespace std;
class SList
{
SeqList S;
public:
SList()
{
S.length=0;
}
Status ClearList()
{
S.length=0;
return OK;
}
Status EmptyList()
{
if(S.length)
{
return FALSE;
}
else
return OK;
}
int ListLengh()
{
return S.length;
}
int Locate(DataType e)
{
for(int i=0; i<S.length; i++)
{
if(S.data[i]==e)
{
return i+1;
}
}
return FALSE;
}
DataType GetData( int k)
{
if(k<1||k>S.length)
{
return FALSE;
}
return S.data[k-1];
}
void InsList()
{
while(1)
{
bool b;
int pos;
DataType e;
cout<<"请输入位置插入:"<<endl;
cin>>pos;
pos--;
if(pos>=0&&pos<=S.length)
{
cout<<"请输入插入元素的值:"<<endl;
cin>>e;
for(int i=S.length-1; i>=pos; i--)
{
S.data[i+1]=S.data[i];
}
S.data[pos]=e;
S.length++;
cout<<"Success"<<endl;
cout<<"是否继续插入: "<<endl;
cout<<"是 1"<<endl;
cout<<"否 0"<<endl;
cin>>b;
if(!b)
{
break;
}
}
else cout<<"位置非法"<<endl;
}
};
Status DelList(DataType &e)
{
while(1)
{
bool b;
int pos;
cout<<"请输入删除位置:"<<endl;
cin>>pos;
pos--;
if(pos>=0&&pos<=S.length-1)
{
e=S.data[pos];
for(int i=pos; i<S.length-1; i++)
{
S.data[i]=S.data[i+1];
}
S.length--;
cout<<"Success"<<endl;
cout<<"是否继续删除: "<<endl;
cout<<"是 1"<<endl;
cout<<"否 0"<<endl;
cin>>b;
if(!b)
{
break;
}
}
else cout<<"位置非法"<<endl;
}
return OK;
}
};
int main()
{
return 0;
}