I have some input from a file that i put into an array and i need to do two things with this array. First i need to know how to modify it so that when i output it only 9 values will appear per line, and secondly i need to know how to determine which value occurs most frequently and then output that #.
Please help!
Here's what i have so far:
#include <iostream>
#include <fstream>
using namespace std;
#define SIZE 200
ifstream myin;
ofstream myout;
int main()
{
int x[SIZE],i=0,h=0;
myin.open("numbers.txt",ios::in);
while(myin>>x[i])
{
if(x[i]%5==0)
{
cout<<x[i]<<" ";
h++;
}
i++;
}
cout<<endl;
cout<<i<<endl;
cout<<h<<endl;
myin.close();
return 0;
}

To determine which value occurs most frequently, you need another array to store a running count of how many times that number has occurred. Also your array size should be the size of the largest value in your file. For example, if the largest number in your file is 2000, then: