#include<iostream>
using namespace std;
#define MAXN 1024
#define DateType int
struct SeqList {
DateType data[MAXN];
int length;
};
DateType SeqListIndex(struct SeqList *sq, int i) {
if (i < 0 || i > sq->length) {
return -1;
}
return sq->data[i];
}
DateType SeqListFind(struct SeqList *sq, DateType dt) {
for (int i = 0; i < sq->length; i++) {
if (sq->data[i] == dt) {
return i;
}
}
return -1;
}
DateType SeqListGetLength(struct SeqList *sq) {
return sq->length;
}
DateType SeqListInsert(struct SeqList *sq, int k, DateType v) {
if (sq->length == MAXN) {
return 0;
}
for (int i = sq->length; i > k; i--) {
sq->data[i] = sq->data[i - 1];
}
sq->data[k] = v;
sq->length++;
return 1;
}
DateType SeqListDelete(struct SeqList* sq, int k) {
if (k > sq->length) {
return 0;
}
for (int i = k; i < sq->length - 1; i++) {
sq->data[i] = sq->data[i + 1];
}
sq->length--;
return 1;
}
int main() {
return 0;
}
|