I need help adding a value returning function that uses a do loop so it can determine the number of elements in the array that are between 110 and 155. how can I add that to this program! Help!
#include <iostream>
#include <ctime>
using namespace std;
//function prototypes
void displayArray(int numbers[], int numElements);
int getRandom(int numbers[], int numElements);
int main()
{
//declare array
int randNums[100] = {0};
//initialize random number generator
srand(static_cast<int>(time(0)));
//assign random integers from 100
//through 200 to the array
for (int sub = 0; sub < 100; sub += 1)
randNums[sub] = 100 + rand() % (200 - 1 + 1);
//end for
//display array
displayArray(randNums, 100);
system("pause");
return 0;
} //end of main function
//*****funtion prototype*****
void displayArray(int numbers[], int numElements)
{
for (int sub = 0; sub < numElements; sub +=1)
cout << numbers[sub] << endl;
//end for
} //end of displayArray function
int getRandom(int numbers[], int numElements)
{
//assign first element's value
//to the high variable
int random = numbers[0];
//begin the search with the second element
int x = 1;
//search for random number
while (x < numElements)
{
if (numbers[x] > random)
random = numbers[x];
//end if
x +=1;
} //end while