Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include "stdafx.h"
- #include <iostream>
- using namespace std;
- int main()
- {
- int n; cout<<"n="; cin>>n;
- int *a=new int [n];
- for (int i=0; i<n; i++)
- {
- cout<<"a["<<i<<"]="; cin>>a[i];
- }
- int k; cout<<"k="; cin >>k;
- int p; cout<<"p="; cin >>p;
- int e=p-k;
- if (k<0 || k>n-1)
- cout <<"error";
- else {for (int i=k; i<n-1; i++) a[i]=a[i+e+1];
- n--;
- for (int i=0; i<n; i++) cout << a[i]<<"\t";}
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement