ahmed0saber

Delete repeated data in C++

Nov 7th, 2020
51
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.27 KB | None | 0 0
  1. #include <iostream>
  2. using namespace std;
  3. int main()
  4. {
  5.     int a[]={1,2,2,1,3,4,5,3,3};
  6.     for(int i=0;i<10;i++)
  7.     {
  8.         bool equal=false;
  9.         for(int j=i-1;j>=0;j--)
  10.         {
  11.             if(a[i]==a[j])
  12.             {
  13.                 equal=true;
  14.             }
  15.         }
  16.         if(!equal)
  17.         {
  18.             cout<<a[i]<<endl;
  19.         }
  20.     }
  21. }
Advertisement
Add Comment
Please, Sign In to add comment