严蔚敏版教材,算法2.4,代码实现
#include
using namespace std;
typedef int element;
#define maxsize 100
typedef struct
{
element aa[maxsize];
int last;
}sqlist;
int main()
{
int len,pos;
sqlist *la;
int *p,*q;
la=(sqlist *)malloc(sizeof(sqlist));
cout<
cin>>len;
la->last=len-1;
cout<
for(int i=0;i
cin>>la->aa[i];
cout<
cin>>pos;
q=&(la->aa[pos-1]);
// cout<
//p=&(la->aa[la->last]);
//cout<
for(p=q;paa[la->last]);p++)
*p=*(p+1);
la->last--;
for(int i=0;i<=la->last;++i)
cout<aa[i]<
cout<
return 0;
}