#include <iostream>
using namespace std;
#define MaxSize 10
typedef struct
{int data[MaxSize];int length;
} SqList;
void InitList(SqList &L)
{for (int i = 0; i < MaxSize; i++){L.data[i] = 0;}L.length = 0;
}
bool ListInsert(SqList &L, int i, int e)
{if (i < 1 || i > L.length + 1){return false;}if (L.length >= MaxSize){return false;}for (int j = L.length; j >= i; j--){L.data[j] = L.data[j - 1];}L.data[i - 1] = e;L.length++;return true;
}
bool ListDelete(SqList &L, int i, int &e)
{if (i < 1 || i > L.length){return false;}e = L.data[i - 1];for (int j = i; j < L.length; j++){L.data[j - 1] = L.data[j];}L.length--;return true;
}
void ListTraverse(SqList L)
{for (int i = 0; i < L.length; i++){cout << L.data[i] << " ";}cout << endl;
}
int main()
{int e;SqList L;InitList(L);ListInsert(L, 1, 1);ListInsert(L, 2, 2);ListInsert(L, 3, 3);ListDelete(L, 2, e);cout << "删除的元素是" << e << endl;ListTraverse(L);return 0;
}