dd
#include <stdio.h>
#include <iostream>
using namespace std;
#define maxsize 1000000
typedef struct Num
{
int a[maxsize];
int len;
}Num;
int t;
void Insert_List(Num *&l)
{
int i, n;
l=new Num;
cin>>n;
cin>>t;
for(i = 0;i<n;i++)
{
cin>>l->a[0];
if(i!=n-1)
{
for(int j = i;j>=0;j--)
l->a[j+1]=l->a[j];
}
}
l->len=n;
}
void Delete_Num(Num *&l)
{
int ff;
for(int i=0;i<l->len;i++)
{
if(l->a[i]==t)
{
for(int j=i;j<(l->len-1);j++)
{
l->a[j]=l->a[j+1];
}
i=i-1;
l->len--;
}
}
}
void Print(Num *&l)
{
//cout<<l->len<<endl;
for(int i=0;i<l->len;i++)
{
if(i==0)cout<<l->a[0];
else cout<<" "<<l->a[i];
}
if(l->len!=0) cout<<endl;
}
int main()
{
Num *List;
Insert_List(List);
Print(List);
Delete_Num(List);
Print(List);
//system("pause");
}
posted on 2012-12-05 18:22 More study needed. 阅读(153) 评论(0) 编辑 收藏 举报