const int NUM_MAX = 100;
const int HOWMANY = 30;
int main()
{
vector<int> myVector;
int counters[NUM_MAX] = { 0 };
//to print out 15 numbers per line
int x = 15;
//seed random number generator
srand(time(0));
cout << "Array of 30 Random Numbers: "<< endl;
for (int i = 0; i < HOWMANY; i++)
{
int myRandom = rand() % NUM_MAX;
myVector.push_back(myRandom);
int thisVal = myVector[i];
cout << thisVal << " ";
if (i % x == 0)
cout << "\n";
}
cout << " " << endl;
return 0;
}
I'm just starting to learn about vectors and arrays, and my teacher has the counters
array set up for us, but I'm not sure what to do with that. I have to find the number that occurs the most in the 30 random generated numbers, and I have to count how many times that number appeared. I'm very lost.