#include <iostream>
#include <cstdlib>
using namespace Std;
typedef int T;
Class Seqlist
{
Public
T *data;
int q[100];
int n;
int MaxSize; The maximum number of elements that a sequential table can hold.
int last; The subscript of the last element of the sequential table, with an initial value of-1.
seqlist (int sz);
void input ()//Enter the number of elements first, and then enter the value of the element sequentially.
void output ();//output all elements of a linear table.
void Insert (const t& x, int i);//Inserts an element with a value of x in the linear table.
void Remove (T & x);//Removes the first value equal to X from a linear table.
};
void Seqlist::input ()
{
cin>>n;
for (int i=0;i<n;i++)
{
cin>>data[i];
}
}
void Seqlist::output ()
{
cout<< "The Elements is:" << ' \ n ';
for (int i=0;i<n;i++)
{
cout<<data[i]<< ' \ n ';
}
}
void Seqlist::insert (const t& x, int i)
{
for (int j= (n-1); j>=i;j--)
{
DATA[J+1]=DATA[J];
}
Q[i]=x;
n=n+1;
}
void Seqlist::remove (T & x)
{
for (int j=0;j<n;j++)
{
if (data[j]==x)
{
for (int k=j;k<n-1;k++)
{
DATA[K]=DATA[K+1];
}
n=n-1;
}
}
}
seqlist::seqlist (int sz)
{
data = new T[sz];
MaxSize = sz;
last =-1;
}
int main ()
{
Seqlist myList (100);
Mylist.input ();
Mylist.output ();
int i;
for (i=0;i<5;i++)
Mylist.insert (I+10,i);
Mylist.output ();
for (i=10;i<15;i++)
Mylist.remove (i);
Mylist.output ();
return 0;
}
List of links is different