Advertisement
STANAANDREY

Remove_duplicate(const space)

Jul 3rd, 2019
224
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.27 KB | None | 0 0
  1. #include <bits/stdc++.h>
  2. using namespace std;
  3.  
  4. int main()
  5. {
  6. const int n=10;
  7. int v[]={1,2,2,3,3,4,4,4,5,6};
  8. int j=0;
  9.  
  10. for (int i=0;i<n-1;i++)
  11. if (v[i]!=v[i+1])
  12. {
  13.     v[j]=v[i];
  14.     j++;
  15. }
  16. v[j]=v[n-1];
  17. for (int i=0;i<=j;i++)
  18.     cout<<v[i]<<' ';
  19.     return 0;
  20. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement