Hello i have a code here that partially works...the point in the program is to store 10 array integers then outputs how many times that integer is entered
ex. input: 1 1 1 1 1 2 3 3 2 99
output : 1 = 5
2 = 2
3 = 2
99 = 1
well, my code runs..but the output is that it displays all numbers in the array and the number of times it entered ..so i need help...
#include<iostream>
#include<limits>
using namespace std;
int main()
{
const int max =10;
int a[max], count=0, n;
cout<<"Enter 10 integer values: ";
for(int i=0;i<max;i++)
{
cin>>a[i];//input numbers
}
for(int i=0;i<max;i++)
{
for(int j=0;j<max;j++)
{
if(a[i]== a[j])
{
count++;// count houw many inegers are the same
}
}
cout<<a[i]<< " = "<<count<<endl;
count= 0;
}
cin.ignore(numeric_limits<streamsize>::max(),'\n');
cin.get();
return 0;
}
need advice on what to remove or add...
do i have to add functions?
Thanks