顺序表
`
include
using namespace std;
define MAX 30
void insert(int a[], int pos, int num) {
a[pos] = num;
for (int i = pos+1; i <= MAX; i++) {
a[i + 1] = a[i];
}
}
void del(int a[], int pos) {
for (int i = pos+1; i <= MAX; i++) {
a[i - 1] = a[i];
}
}
int main(int argc, char **argv) {
int a[MAX];
for (int i = 1; i <= MAX; i++) {
a[i] = 0;
}
insert(a, 3, 10);
insert(a,4,6);
insert(a,5,2);
insert(a,7,90);
del(a,3);
for (int i = 1; i <= MAX; i++) {
cout << a[i] << endl;
}
return 0;
}
`