I need help with my coding I need to be able to take in at most 300 integers(0 to 100) and then fin the count of zeros and evens. After this i need to add all of the integers up and get the average. Find the maximum and minimum values and then get the first odd given and last odd given. Following this I need to get the standard deviation, and then sort the numbers and show the first 10. I get all of this done fine and then i go into making a frequency table and fining the mode of this table. I can get one number to show up for mode but if i use (ex: 1,2,3,4,4,4,5,6,6,6) it will only show me the 6 as the mode how can i make it show me the average of the two 4 and 6?
My code is for the mode and frequency table is
//freq = 0
int freq[100];
for(i = 0; i <= 100; i++)
{
freq[i] = 0;
for(j = 1; j <= quant; j++)
{
if(data[j] == i)
freq[i]++;
}
}
//mode
int mode;
mode = -100;
for (i = 0; i <= quant; i++)
cout << i <<" appears "<<freq[i]<<" times."<<endl;
for(i = 0; i <= 100; i++)
{
if(freq[i] > mode)
mode = i;
}
cout<<mode<<endl;
Please Help me.