#include<iostream>
#include<cstdlib>
using namespace std;
typedef struct
{
int data[100];
int length;
}List;
void Init(List *&L)
{
L=(List *)malloc(sizeof(List));
L->length=0;
}
void Creat(List *&L)
{
int i,n;
cin>>n;
L->length=n;
for(i=0;i<n;i++)
{
cin>>L->data[i];
}
}
void Dele(List *&A,List *&B)
{
int i,j=0,s1,s2;
cin>>s1>>s2;
for(i=0;i<A->length;i++)
{
if(s1<=A->data[i] && s2>=A->data[i]) continue;
else B->data[j++]=A->data[i];
}
B->length=j;
}
void Disp(List *&L)
{
int i;
for(i=0;i<L->length;i++)
{
cout<<L->data[i]<<' ';
}
}
int main()
{
List *A,*B;
Init(A);
Init(B);
Creat(A);
Dele(A,B);
Disp(B);
return 0;
}
SWUST数据结构--删除顺序表中指定区间的数据
最新推荐文章于 2020-02-12 20:29:44 发布