hi
this program is for counting number of nons ame elements in an array of size 5
i think this program is specific for array of size 5 this is not general
i want to make a general program, means by changing just 1 or 2 values in the code i can use it for higher size arrays here is my code
Code:
# include <iostream>
# include <conio.h>
# include <windows.h>
using namespace std;
int main ()
{
int a[10];
char push_key='#';
while (push_key!='@')
{
double n=0;
for (int i=0;i<5;i++)
{
cout<<"enter number";
cin>>a[i];
}//end for
for (int i=0;i<5;i++)
{
for (int j=i+1;j<5;j++)
{
if (a[i]==a[j])
{
n++;
}//end if
}//end for
if (n==4)
{
break;
}//end if
}//end for
if (n==4){
cout<<"total non same elements are:"<<4-n<<endl;
cout<<endl<<endl;
}//end if
if (n<4)
{
cout<<"total non same elements are:"<<5-n<<endl;
cout<<endl<<endl;
}//end if
if (n>4)
{
any help will b appreciated thanks