Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<bits/stdc++.h>
- using namespace std;
- int a[100];
- int main()
- {
- int n,j,i,x,item;
- cin>>n;
- vector<int>ar;
- for(i=0;i<n;i++)
- {
- cin>>x;
- ar.push_back(x);
- }
- cout <<"enter position";
- cin>>j;
- cout<<"enter item";
- cin>>item;
- for(i=j;i<=n;i++)
- {
- a[i+1]=ar[i];
- a[j]=item;
- }
- for(i=0;i<j;i++)
- {
- a[i]=ar[i];
- }
- for(i=0;i<n;i++)
- {
- cout<<a[i]<<" ";
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement