#include <stdio.h>
typedef int ElemType;
#define MAXSIZE 100
typedef struct{
ElemType date[MAXSIZE];
int length;
}Seqlist;
bool delete_s_t_list(Seqlist &L,ElemType s,ElemType t){
if(s<0||s>L.length){
return false;
}
if(L.length==0){
return false;
}
int k=0;
for (int i=0;i<L.length;i++){
if(L.date[i]<=s||L.date[i]>=t){
L.date[k]=L.date[i];
k++;
}
}
L.length=k;
return true;
}
void print_list(Seqlist L){
for(int i=0;i<L.length;i++){
printf("%3d",L.date[i]);
}
}
int main() {
Seqlist L;
ElemType s,t;
L.date[0]=1;
L.date[1]=2;
L.date[2]=0;
L.date[3]=4;
L.date[4]=6;
L.date[5]=2;
L.length=6;
ElemType value;
bool net;
net = delete_s_t_list(L,1,4);
if(net){
printf("delete sucessful\n");
}else{
printf("error\n");
}
print_list(L);
return 0;
}