So my assignment is to let the user create set the size of array, maximum and minimum number for the randomly generated array. The FillArray() function is suppose to prompt the user for the size, min and max number but not display it. The information is saved and the user has to select another function called MinFreq() that generates the array and displays it, look for the minimum of the numbers generated and display the frequency of the number. What i have below is FillArray() asking for size, min and max, but it also shows the generated array. How do i make it so that it doesn't until the function MinFreq() is called?
void FillArray()
{
int size, min, max;
cout << "How many elements in the array? "; //user inputs how many elements they want
cin >> size;
cout << "What is the minimum number? ";
cin >> min;
cout << "What is the maximum number? ";
cin >> max;
int* theArray = newint[size]; //sets amount of array
srand(time(0));
for (int i = 0; i < size; i++)
{
theArray[i] = rand()%((max+1)-min)+min;
cout << endl << theArray[i] << endl;
}
}
void MinFreq()
{
}