constint MaxSize =50;template<classT>classSeqList{public:SeqList(){ length =0;}SeqList(T a[],int n);~SeqList();intLength(){return length;}voidInsert(int i, T x);
T GetW(int i);intGetZ(T x);
T Delete(int i);voidPrint();private:
T data[MaxSize];int length;};
SeqList.cpp
template<classT>
SeqList<T>::SeqList(T a[],int n){if(n > MaxSize)throw"上溢";for(int j =0; j < n; j++)
data[j]= a[j];
length = n;}template<classT>void SeqList<T>::Insert(int i, T x){int j;if(i >= MaxSize)throw"上溢";if(i<1|| i>length +1)throw"上溢";for(j = length; j>= i; j--)
data[j]= data[j -1];
data[i -1]= x;
length++;}template<classT>
T SeqList<T>::GetW(int i){if(i<1|| i>length)throw"位置";elsereturn data[i -1];}template<classT>int SeqList<T>::GetZ(T x){for(int i =0; i < length; i++){if(data[i]== x)return i +1;}return0;}template<classT>
T SeqList<T>::Delete(int i){
T x;if(length ==0)throw"下溢";if(i > length || i <1)throw"位置";
x = data[i -1];int j;for(j = i -1; j < length; j++)
data[j]= data[j +1];
length--;return x;}template<classT>void SeqList<T>::Print(){for(int i =0; i < length; i++)
cout << data[i];}template<classT>
SeqList<T>::~SeqList(){}