Advertisement
Md_hosen_zisad

delete array

Mar 23rd, 2018
394
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.45 KB | None | 0 0
  1. #include<bits/stdc++.h>
  2. using namespace std;
  3. int a[100];
  4. int main()
  5. {
  6.     int n,j,i,x,item;
  7.     cin>>n;
  8.     vector<int>ar;
  9.     for(i=0;i<n;i++)
  10.     {
  11.         cin>>x;
  12.         ar.push_back(x);
  13.     }
  14.     cout <<"enter position";
  15.     cin>>j;
  16.     for(i=j;i<n;i++)
  17.     {
  18.         ar[i]=ar[i+1];
  19.     }
  20.     for(i=0;i<j;i++)
  21.     {
  22.         a[i]=ar[i];
  23.  
  24.     }
  25.     for(i=0;i<n-1;i++)
  26.     {
  27.         cout<<ar[i]<<" ";
  28.     }
  29.     return 0;
  30.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement