Code:
for (studentNumber = 0; studentNumber < numStudents; ++studentNumber)
{
if( lowRange < grades[studentNumber] && grades[studentNumber] < highRange ) ++gradesInRange;
}
That would get the number of grades between the low and high ranges (exclusive)... if you wanted to include the low and high points you would change the < to <=.
Code:
void RangeData(int *grades, int numStudents)
{
...
cout<<"\nWould you like to look up another range? (y/n) ";
cin>>rangeAgain;
if(rangeAgain == 'y' || rangeAgain == 'Y')
{
RangeData(grades, numStudents);
}
else if(rangeAgain == 'n' || rangeAgain == 'N')
{
return;
}
}//end RangeData
I would suggest using another loop within the function to take the place of the recursion. Something similar to:
Code:
void RangeData(int *grades, int numStudents)
{
...
do
{
cout<<"\n\nEnter the low value for a grade range look up: ";
cin>>lowRange;
cout<<"Enter the high vaule for a grade range look up: ";
cin>>highRange;
...
cout<<"\nWould you like to look up another range? (y/n) ";
cin>>rangeAgain;
} while( rangeAgain == 'Y' || rangeAgain == 'y' );
}//end RangeData