Hi,
I would like to know the algorithm or flow for finding unequal elements in an array entered by user. I tried using for loop but didn't get the expected output
Code:
#include <iostream>
#include <string>
using namespace std;
int main()
{
int a[10],b[10]; //array of integer elements
int i,j,k ; //traversing operators
int r =0;
cout<<"Enter Array Elements = ";
for(i=0;i<=9;i++)
    cin>>a[i];

cout<<"The common elements are ";
//For to loop to compare all elements and find unique elements
for(j=0;j<=9;j++)
{

    for(k=j;k<9;k++)
   {if (a[k] != a[j] && k!=j)
       r++;

   break;
   }


}
cout<<"The number of unique elements in the array="<<r;

return 0;
}
Thanks for time and consideration awaiting response.