//顺序表
include [HTML_REMOVED]
using namespace std;
struct List{
int *arr;
int length;
}
//创建线性表
List createList(){
List list;
list.length = 0;
list.arr = new int[100];
return list;
}
//插入操作
void insert(List &list,int index,int value){
if(list.length == 100){
cout << “线性表已满” <[HTML_REMOVED]= index; i–){
list.arr[i+1] = list.arr[i];
}
list.arr[index] = value;
list.length++;
}
//查找操作
int serch(List list;int value){
for(int i = 0;i < list.length;i++){
if(list.arr[i] == value) return i;
}
return -1;
}
//输出所有元素
void print(List list){
for(int i = 0;i<list.length;i++){
cout << list.arr[i] << ” “;
}
cout << endl;
}