>int total = fill_array(int ar[], int n);
should be
int total = fill_array(numbers, ArSize);
A better algorithm would be to read in two integers from the user, check to see if one of them is zero, and then branch off.
Code:
inline double hMean(int x, int y)
{
return (double)2 * x * y / (x+y);
}
int main ( void )
{
int high, low;
double d;
for ( ; ; ) { //forEVER
cout<<"Enter two integers"<<endl;
cin>>high>>low;
if ( high == 0 || low == 0 )
return EXIT_SUCCESS;
d = hMean(high, low);
cout<<"The harmonic mean is "<< d <<endl;
}
return EXIT_SUCCESS;
}
/* Untested code */
Throw an infinite loop around the processing in main for the program to run until the user enters a 0 as one of the integers.
-Prelude